PlotSquared source diff between v6 and v7

Files changed (165) hide show
  1. .github/workflows/build.yml +9 -7
  2. .github/workflows/codeql.yml +3 -1
  3. Bukkit/build.gradle.kts +3 -4
  4. Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +8 -0
  5. Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java +2 -14
  6. Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +189 -20
  7. Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java +8 -2
  8. Bukkit/src/main/java/com/plotsquared/bukkit/generator/LegacyBlockStatePopulator.java +2 -2
  9. Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +89 -24
  10. Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java +16 -5
  11. Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java +0 -91
  12. Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +138 -67
  13. Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java +14 -4
  14. Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +4 -24
  15. Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayerManager.java +1 -3
  16. Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java +5 -2
  17. Bukkit/src/main/java/com/plotsquared/bukkit/schematic/StateWrapper.java +0 -30
  18. Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java +35 -9
  19. Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java +1 -1
  20. Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java +3 -3
  21. Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +5 -4
  22. Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitWorld.java +0 -8
  23. Bukkit/src/main/java/com/plotsquared/bukkit/util/TranslationUpdateManager.java +63 -0
  24. Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweRegionManager.java +0 -5
  25. Core/build.gradle.kts +2 -1
  26. Core/src/main/java/com/plotsquared/core/PlotAPI.java +3 -3
  27. Core/src/main/java/com/plotsquared/core/PlotSquared.java +3 -1
  28. Core/src/main/java/com/plotsquared/core/backup/PlayerBackupProfile.java +1 -1
  29. Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java +5 -4
  30. Core/src/main/java/com/plotsquared/core/command/Add.java +17 -10
  31. Core/src/main/java/com/plotsquared/core/command/Alias.java +19 -8
  32. Core/src/main/java/com/plotsquared/core/command/Area.java +141 -100
  33. Core/src/main/java/com/plotsquared/core/command/Auto.java +28 -18
  34. Core/src/main/java/com/plotsquared/core/command/Backup.java +74 -30
  35. Core/src/main/java/com/plotsquared/core/command/Biome.java +10 -10
  36. Core/src/main/java/com/plotsquared/core/command/Buy.java +15 -9
  37. Core/src/main/java/com/plotsquared/core/command/Caps.java +14 -9
  38. Core/src/main/java/com/plotsquared/core/command/Chat.java +0 -54
  39. Core/src/main/java/com/plotsquared/core/command/Claim.java +32 -14
  40. Core/src/main/java/com/plotsquared/core/command/Clear.java +8 -4
  41. Core/src/main/java/com/plotsquared/core/command/Cluster.java +151 -83
  42. Core/src/main/java/com/plotsquared/core/command/CmdConfirm.java +8 -4
  43. Core/src/main/java/com/plotsquared/core/command/Command.java +36 -19
  44. Core/src/main/java/com/plotsquared/core/command/CommandCaller.java +2 -2
  45. Core/src/main/java/com/plotsquared/core/command/CommandCategory.java +7 -0
  46. Core/src/main/java/com/plotsquared/core/command/Comment.java +19 -9
  47. Core/src/main/java/com/plotsquared/core/command/Condense.java +28 -13
  48. Core/src/main/java/com/plotsquared/core/command/Continue.java +8 -4
  49. Core/src/main/java/com/plotsquared/core/command/Copy.java +9 -4
  50. Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java +4 -2
  51. Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java +17 -7
  52. Core/src/main/java/com/plotsquared/core/command/Debug.java +47 -17
  53. Core/src/main/java/com/plotsquared/core/command/DebugExec.java +17 -9
  54. Core/src/main/java/com/plotsquared/core/command/DebugPaste.java +13 -9
  55. Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java +12 -10
  56. Core/src/main/java/com/plotsquared/core/command/Delete.java +10 -5
  57. Core/src/main/java/com/plotsquared/core/command/Deny.java +10 -5
  58. Core/src/main/java/com/plotsquared/core/command/Desc.java +5 -3
  59. Core/src/main/java/com/plotsquared/core/command/Done.java +5 -3
  60. Core/src/main/java/com/plotsquared/core/command/Download.java +25 -10
  61. Core/src/main/java/com/plotsquared/core/command/FlagCommand.java +106 -59
  62. Core/src/main/java/com/plotsquared/core/command/Grant.java +9 -7
  63. Core/src/main/java/com/plotsquared/core/command/Help.java +16 -11
  64. Core/src/main/java/com/plotsquared/core/command/HomeCommand.java +10 -6
  65. Core/src/main/java/com/plotsquared/core/command/Inbox.java +45 -30
  66. Core/src/main/java/com/plotsquared/core/command/Info.java +11 -3
  67. Core/src/main/java/com/plotsquared/core/command/Kick.java +7 -5
  68. Core/src/main/java/com/plotsquared/core/command/Leave.java +4 -2
  69. Core/src/main/java/com/plotsquared/core/command/Like.java +6 -4
  70. Core/src/main/java/com/plotsquared/core/command/ListCmd.java +73 -61
  71. Core/src/main/java/com/plotsquared/core/command/Load.java +11 -43
  72. Core/src/main/java/com/plotsquared/core/command/MainCommand.java +4 -3
  73. Core/src/main/java/com/plotsquared/core/command/Merge.java +34 -19
  74. Core/src/main/java/com/plotsquared/core/command/Move.java +7 -3
  75. Core/src/main/java/com/plotsquared/core/command/Music.java +19 -8
  76. Core/src/main/java/com/plotsquared/core/command/Near.java +4 -2
  77. Core/src/main/java/com/plotsquared/core/command/Owner.java +19 -8
  78. Core/src/main/java/com/plotsquared/core/command/PluginCmd.java +5 -3
  79. Core/src/main/java/com/plotsquared/core/command/Purge.java +11 -6
  80. Core/src/main/java/com/plotsquared/core/command/Rate.java +7 -5
  81. Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java +8 -6
  82. Core/src/main/java/com/plotsquared/core/command/Remove.java +7 -5
  83. Core/src/main/java/com/plotsquared/core/command/Save.java +0 -130
  84. Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java +37 -14
  85. Core/src/main/java/com/plotsquared/core/command/Set.java +9 -4
  86. Core/src/main/java/com/plotsquared/core/command/SetCommand.java +11 -3
  87. Core/src/main/java/com/plotsquared/core/command/SetHome.java +4 -2
  88. Core/src/main/java/com/plotsquared/core/command/Setup.java +7 -2
  89. Core/src/main/java/com/plotsquared/core/command/Swap.java +7 -3
  90. Core/src/main/java/com/plotsquared/core/command/Target.java +5 -3
  91. Core/src/main/java/com/plotsquared/core/command/Template.java +17 -8
  92. Core/src/main/java/com/plotsquared/core/command/Toggle.java +17 -15
  93. Core/src/main/java/com/plotsquared/core/command/Trust.java +19 -9
  94. Core/src/main/java/com/plotsquared/core/command/Unlink.java +4 -2
  95. Core/src/main/java/com/plotsquared/core/command/Visit.java +23 -17
  96. Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java +19 -10
  97. Core/src/main/java/com/plotsquared/core/configuration/caption/Caption.java +11 -0
  98. Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionHolder.java +32 -6
  99. Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java +2 -2
  100. Core/src/main/java/com/plotsquared/core/configuration/caption/StaticCaption.java +7 -0
  101. Core/src/main/java/com/plotsquared/core/configuration/caption/Templates.java +0 -103
  102. Core/src/main/java/com/plotsquared/core/configuration/caption/TranslatableCaption.java +15 -0
  103. Core/src/main/java/com/plotsquared/core/events/PlayerAutoPlotEvent.java +0 -32
  104. Core/src/main/java/com/plotsquared/core/events/PlayerTeleportToPlotEvent.java +0 -9
  105. Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java +4 -19
  106. Core/src/main/java/com/plotsquared/core/generator/HybridGen.java +72 -44
  107. Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +2 -28
  108. Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java +1 -15
  109. Core/src/main/java/com/plotsquared/core/generator/IndependentPlotGenerator.java +23 -14
  110. Core/src/main/java/com/plotsquared/core/generator/SingleWorldGenerator.java +19 -7
  111. Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +35 -44
  112. Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java +4 -2
  113. Core/src/main/java/com/plotsquared/core/permissions/Permission.java +9 -5
  114. Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java +4 -4
  115. Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +11 -10
  116. Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java +48 -40
  117. Core/src/main/java/com/plotsquared/core/plot/Plot.java +86 -131
  118. Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +17 -37
  119. Core/src/main/java/com/plotsquared/core/plot/PlotId.java +0 -11
  120. Core/src/main/java/com/plotsquared/core/plot/PlotManager.java +0 -9
  121. Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java +8 -3
  122. Core/src/main/java/com/plotsquared/core/plot/PlotWorld.java +0 -8
  123. Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java +7 -3
  124. Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java +16 -34
  125. Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java +0 -8
  126. Core/src/main/java/com/plotsquared/core/plot/flag/FlagParseException.java +6 -6
  127. Core/src/main/java/com/plotsquared/core/plot/flag/PlotFlag.java +11 -9
  128. Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java +7 -2
  129. Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DescriptionFlag.java +1 -1
  130. Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FeedFlag.java +5 -3
  131. Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GreetingFlag.java +1 -1
  132. Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java +5 -3
  133. Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java +4 -2
  134. Core/src/main/java/com/plotsquared/core/plot/world/DefaultPlotAreaManager.java +3 -2
  135. Core/src/main/java/com/plotsquared/core/plot/world/PlotAreaManager.java +3 -1
  136. Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotAreaManager.java +2 -2
  137. Core/src/main/java/com/plotsquared/core/queue/BlockArrayCacheScopedQueueCoordinator.java +5 -3
  138. Core/src/main/java/com/plotsquared/core/queue/ChunkQueueCoordinator.java +0 -163
  139. Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java +5 -23
  140. Core/src/main/java/com/plotsquared/core/queue/{ScopedQueueCoordinator.java → ZeroedDelegateScopedQueueCoordinator.java} +8 -6
  141. Core/src/main/java/com/plotsquared/core/queue/subscriber/DefaultProgressSubscriber.java +7 -2
  142. Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java +7 -2
  143. Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java +12 -5
  144. Core/src/main/java/com/plotsquared/core/util/ChunkManager.java +14 -17
  145. Core/src/main/java/com/plotsquared/core/util/ComponentHelper.java +65 -0
  146. Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java +24 -8
  147. Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java +11 -5
  148. Core/src/main/java/com/plotsquared/core/util/MainUtil.java +0 -82
  149. Core/src/main/java/com/plotsquared/core/util/PatternUtil.java +4 -2
  150. Core/src/main/java/com/plotsquared/core/util/Permissions.java +0 -148
  151. Core/src/main/java/com/plotsquared/core/util/PlayerManager.java +17 -59
  152. Core/src/main/java/com/plotsquared/core/util/RegExUtil.java +0 -34
  153. Core/src/main/java/com/plotsquared/core/util/RegionManager.java +0 -11
  154. Core/src/main/java/com/plotsquared/core/util/RegionUtil.java +0 -5
  155. Core/src/main/java/com/plotsquared/core/util/TabCompletions.java +0 -54
  156. Core/src/main/java/com/plotsquared/core/util/WorldUtil.java +2 -23
  157. Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpObject.java +24 -17
  158. Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpPage.java +20 -24
  159. Core/src/main/java/com/plotsquared/core/util/placeholders/PlaceholderRegistry.java +1 -3
  160. Core/src/main/java/com/plotsquared/core/util/task/AutoClaimFinishTask.java +4 -2
  161. Core/src/main/java/com/plotsquared/core/uuid/UUIDMapping.java +0 -8
  162. Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java +7 -22
  163. Core/src/main/resources/lang/messages_en.json +15 -15
  164. build.gradle.kts +2 -2
  165. gradle/libs.versions.toml +0 -2
.github/workflows/build.yml CHANGED
@@ -3,7 +3,7 @@ name: build
3
3
  on:
4
4
  push:
5
5
  branches:
6
- - v6
6
+ - v7
7
7
 
8
8
  jobs:
9
9
  build:
@@ -30,7 +30,7 @@ jobs:
30
30
  echo "STATUS=release" >> $GITHUB_ENV
31
31
  fi
32
32
  - name: Publish Release
33
- if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
33
+ if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v7'}}
34
34
  run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
35
35
  env:
36
36
  ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
@@ -38,13 +38,14 @@ jobs:
38
38
  ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
39
39
  ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
40
40
  - name: Publish Snapshot
41
- if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6' }}
41
+ if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v7' }}
42
42
  run: ./gradlew publishToSonatype
43
43
  env:
44
44
  ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
45
45
  ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
46
46
  - name: Publish core javadoc
47
- if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
47
+ # if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v7'}}
48
+ if: ${{ runner.os == 'Linux' && env.STATUS == 'snapshot' && github.event_name == 'push' && github.ref == 'refs/heads/v7'}}
48
49
  uses: cpina/github-action-push-to-another-repository@main
49
50
  env:
50
51
  SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
@@ -54,9 +55,10 @@ jobs:
54
55
  destination-repository-name: 'plotsquared-javadocs'
55
56
  user-email: ${{ secrets.USER_EMAIL }}
56
57
  target-branch: main
57
- target-directory: core
58
+ target-directory: v7/core
58
59
  - name: Publish bukkit javadoc
59
- if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
60
+ # if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v7'}}
61
+ if: ${{ runner.os == 'Linux' && env.STATUS == 'snapshot' && github.event_name == 'push' && github.ref == 'refs/heads/v7'}}
60
62
  uses: cpina/github-action-push-to-another-repository@main
61
63
  env:
62
64
  SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
@@ -66,4 +68,4 @@ jobs:
66
68
  destination-repository-name: 'plotsquared-javadocs'
67
69
  user-email: ${{ secrets.USER_EMAIL }}
68
70
  target-branch: main
69
- target-directory: bukkit
71
+ target-directory: v7/bukkit
.github/workflows/codeql.yml CHANGED
@@ -1,9 +1,11 @@
1
1
  name: "CodeQL"
2
2
 
3
3
  on:
4
+ push:
5
+ branches: [ v7 ]
4
6
  pull_request:
5
7
  # The branches below must be a subset of the branches above
6
- branches: [ v6 ]
8
+ branches: [ v7 ]
7
9
 
8
10
  jobs:
9
11
  analyze:
Bukkit/build.gradle.kts CHANGED
@@ -48,7 +48,6 @@ dependencies {
48
48
 
49
49
  // Our libraries
50
50
  implementation(libs.arkitektonika)
51
- implementation(libs.http4j)
52
51
  implementation("com.intellectualsites.paster:Paster")
53
52
  implementation("com.intellectualsites.informative-annotations:informative-annotations")
54
53
 
@@ -88,7 +87,7 @@ tasks.named<ShadowJar>("shadowJar") {
88
87
  relocate("javax.inject", "com.plotsquared.core.annotation.inject")
89
88
  relocate("net.jcip", "com.plotsquared.core.annotations.jcip")
90
89
  relocate("edu.umd.cs.findbugs", "com.plotsquared.core.annotations.findbugs")
91
- relocate("com.intellectualsites.informative-annotations", "com.plotsquared.core.annotation.informative")
90
+ relocate("com.intellectualsites.annotations", "com.plotsquared.core.annotations.informative")
92
91
 
93
92
  // Get rid of all the libs which are 100% unused.
94
93
  minimize()
@@ -100,10 +99,10 @@ tasks {
100
99
  withType<Javadoc> {
101
100
  val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString()
102
101
  val opt = options as StandardJavadocDocletOptions
103
- opt.links("https://jd.papermc.io/paper/1.18/")
102
+ opt.links("https://jd.papermc.io/paper/1.19/")
104
103
  opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString())
105
104
  opt.links("https://intellectualsites.github.io/plotsquared-javadocs/core/")
106
- opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
105
+ opt.links("https://jd.adventure.kyori.net/api/4.12.0/")
107
106
  opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
108
107
  opt.links("https://checkerframework.org/api/")
109
108
  opt.isLinkSource = true
Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java CHANGED
@@ -50,6 +50,7 @@ import com.plotsquared.bukkit.util.BukkitUtil;
50
50
  import com.plotsquared.bukkit.util.BukkitWorld;
51
51
  import com.plotsquared.bukkit.util.SetGenCB;
52
52
  import com.plotsquared.bukkit.util.UpdateUtility;
53
+ import com.plotsquared.bukkit.util.TranslationUpdateManager;
53
54
  import com.plotsquared.bukkit.util.task.BukkitTaskManager;
54
55
  import com.plotsquared.bukkit.util.task.PaperTimeConverter;
55
56
  import com.plotsquared.bukkit.util.task.SpigotTimeConverter;
@@ -137,6 +138,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
137
138
  import org.incendo.serverlib.ServerLib;
138
139
 
139
140
  import java.io.File;
141
+ import java.io.IOException;
140
142
  import java.lang.reflect.Method;
141
143
  import java.util.ArrayList;
142
144
  import java.util.Arrays;
@@ -290,6 +292,12 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
290
292
  );
291
293
  this.injector.injectMembers(this);
292
294
 
295
+ try {
296
+ this.injector.getInstance(TranslationUpdateManager.class).upgradeTranslationFile();
297
+ } catch (IOException e) {
298
+ throw new RuntimeException(e);
299
+ }
300
+
293
301
  this.serverLocale = Locale.forLanguageTag(Settings.Enabled_Components.DEFAULT_LOCALE);
294
302
 
295
303
  if (PremiumVerification.isPremium() && Settings.Enabled_Components.UPDATE_NOTIFICATIONS) {
Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java CHANGED
@@ -24,9 +24,8 @@ import com.plotsquared.core.generator.IndependentPlotGenerator;
24
24
  import com.plotsquared.core.location.Location;
25
25
  import com.plotsquared.core.location.UncheckedWorldLocation;
26
26
  import com.plotsquared.core.plot.PlotArea;
27
- import com.plotsquared.core.plot.world.PlotAreaManager;
28
27
  import com.plotsquared.core.plot.world.SinglePlotArea;
29
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
28
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
30
29
  import org.bukkit.generator.BlockPopulator;
31
30
  import org.bukkit.generator.LimitedRegion;
32
31
  import org.bukkit.generator.WorldInfo;
@@ -47,17 +46,6 @@ final class BlockStatePopulator extends BlockPopulator {
47
46
  this.plotGenerator = plotGenerator;
48
47
  }
49
48
 
50
- /**
51
- * @deprecated Use {@link BlockStatePopulator#BlockStatePopulator(IndependentPlotGenerator)} as plotAreManager is unused
52
- */
53
- @Deprecated(forRemoval = true, since = "6.9.0")
54
- public BlockStatePopulator(
55
- final @NonNull IndependentPlotGenerator plotGenerator,
56
- final @NonNull PlotAreaManager plotAreaManager
57
- ) {
58
- this.plotGenerator = plotGenerator;
59
- }
60
-
61
49
  @Override
62
50
  public void populate(
63
51
  @NonNull final WorldInfo worldInfo,
@@ -80,7 +68,7 @@ final class BlockStatePopulator extends BlockPopulator {
80
68
  worldInfo.getMaxHeight(),
81
69
  (chunkZ << 4) + 15
82
70
  );
83
- ScopedQueueCoordinator offsetChunkQueue = new ScopedQueueCoordinator(wrapped, min, max);
71
+ ZeroedDelegateScopedQueueCoordinator offsetChunkQueue = new ZeroedDelegateScopedQueueCoordinator(wrapped, min, max);
84
72
  this.plotGenerator.populateChunk(offsetChunkQueue, area);
85
73
  }
86
74
 
Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java CHANGED
@@ -22,20 +22,30 @@ import com.plotsquared.bukkit.queue.GenChunk;
22
22
  import com.plotsquared.bukkit.util.BukkitUtil;
23
23
  import com.plotsquared.bukkit.util.BukkitWorld;
24
24
  import com.plotsquared.core.PlotSquared;
25
+ import com.plotsquared.core.generator.ClassicPlotWorld;
25
26
  import com.plotsquared.core.generator.GeneratorWrapper;
26
27
  import com.plotsquared.core.generator.IndependentPlotGenerator;
27
28
  import com.plotsquared.core.generator.SingleWorldGenerator;
28
29
  import com.plotsquared.core.location.ChunkWrapper;
30
+ import com.plotsquared.core.location.UncheckedWorldLocation;
29
31
  import com.plotsquared.core.plot.PlotArea;
30
32
  import com.plotsquared.core.plot.world.PlotAreaManager;
31
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
33
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
32
34
  import com.plotsquared.core.util.ChunkManager;
35
+ import com.sk89q.worldedit.bukkit.BukkitAdapter;
33
36
  import com.sk89q.worldedit.math.BlockVector2;
37
+ import org.apache.logging.log4j.LogManager;
38
+ import org.apache.logging.log4j.Logger;
39
+ import org.bukkit.HeightMap;
34
40
  import org.bukkit.World;
35
41
  import org.bukkit.block.Biome;
42
+ import org.bukkit.generator.BiomeProvider;
36
43
  import org.bukkit.generator.BlockPopulator;
37
44
  import org.bukkit.generator.ChunkGenerator;
45
+ import org.bukkit.generator.WorldInfo;
38
46
  import org.checkerframework.checker.nullness.qual.NonNull;
47
+ import org.jetbrains.annotations.NotNull;
48
+ import org.jetbrains.annotations.Nullable;
39
49
 
40
50
  import java.util.ArrayList;
41
51
  import java.util.List;
@@ -44,6 +54,8 @@ import java.util.Set;
44
54
 
45
55
  public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrapper<ChunkGenerator> {
46
56
 
57
+ private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + BukkitPlotGenerator.class.getSimpleName());
58
+
47
59
  @SuppressWarnings("unused")
48
60
  public final boolean PAPER_ASYNC_SAFE = true;
49
61
 
@@ -52,9 +64,15 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
52
64
  private final ChunkGenerator platformGenerator;
53
65
  private final boolean full;
54
66
  private final String levelName;
67
+ private final boolean useNewGenerationMethods;
68
+ private final BiomeProvider biomeProvider;
55
69
  private List<BlockPopulator> populators;
56
70
  private boolean loaded = false;
57
71
 
72
+ private PlotArea lastPlotArea;
73
+ private int lastChunkX = Integer.MIN_VALUE;
74
+ private int lastChunkZ = Integer.MIN_VALUE;
75
+
58
76
  public BukkitPlotGenerator(
59
77
  final @NonNull String name,
60
78
  final @NonNull IndependentPlotGenerator generator,
@@ -72,18 +90,23 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
72
90
  this.populators.add(new LegacyBlockStatePopulator(this.plotGenerator));
73
91
  }
74
92
  this.full = true;
93
+ this.useNewGenerationMethods = PlotSquared.platform().serverVersion()[1] >= 19;
94
+ this.biomeProvider = new BukkitPlotBiomeProvider();
75
95
  }
76
96
 
77
97
  public BukkitPlotGenerator(final String world, final ChunkGenerator cg, final @NonNull PlotAreaManager plotAreaManager) {
78
98
  if (cg instanceof BukkitPlotGenerator) {
79
- throw new IllegalArgumentException("ChunkGenerator: " + cg.getClass().getName()
80
- + " is already a BukkitPlotGenerator!");
99
+ throw new IllegalArgumentException("ChunkGenerator: " + cg
100
+ .getClass()
101
+ .getName() + " is already a BukkitPlotGenerator!");
81
102
  }
82
103
  this.plotAreaManager = plotAreaManager;
83
104
  this.levelName = world;
84
105
  this.full = false;
85
106
  this.platformGenerator = cg;
86
107
  this.plotGenerator = new DelegatePlotGenerator(cg, world);
108
+ this.useNewGenerationMethods = PlotSquared.platform().serverVersion()[1] >= 19;
109
+ this.biomeProvider = null;
87
110
  }
88
111
 
89
112
  @Override
@@ -111,7 +134,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
111
134
  try {
112
135
  checkLoaded(world);
113
136
  } catch (Exception e) {
114
- e.printStackTrace();
137
+ LOGGER.error("Error attempting to load world into PlotSquared.", e);
115
138
  }
116
139
  ArrayList<BlockPopulator> toAdd = new ArrayList<>();
117
140
  List<BlockPopulator> existing = world.getPopulators();
@@ -128,6 +151,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
128
151
  return toAdd;
129
152
  }
130
153
 
154
+ // Extracted to synchronized method for thread-safety, preventing multiple internal world load calls
131
155
  private synchronized void checkLoaded(@NonNull World world) {
132
156
  // Do not attempt to load configurations until WorldEdit has a platform ready.
133
157
  if (!PlotSquared.get().isWeInitialised()) {
@@ -153,7 +177,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
153
177
  }
154
178
  }
155
179
 
156
- @SuppressWarnings("deprecation")
180
+ @SuppressWarnings("deprecation") // Kept for compatibility with <=1.17.1
157
181
  private void setSpawnLimits(@NonNull World world, int limit) {
158
182
  world.setAmbientSpawnLimit(limit);
159
183
  world.setAnimalSpawnLimit(limit);
@@ -168,10 +192,112 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
168
192
  */
169
193
  @Deprecated(forRemoval = true, since = "TODO")
170
194
  @Override
195
+ public void generateNoise(
196
+ @NotNull final WorldInfo worldInfo,
197
+ @NotNull final Random random,
198
+ final int chunkX,
199
+ final int chunkZ,
200
+ @NotNull final ChunkData chunkData
201
+ ) {
202
+ if (this.platformGenerator != this) {
203
+ this.platformGenerator.generateNoise(worldInfo, random, chunkX, chunkZ, chunkData);
204
+ return;
205
+ }
206
+ int minY = chunkData.getMinHeight();
207
+ int maxY = chunkData.getMaxHeight();
208
+ GenChunk result = new GenChunk(minY, maxY);
209
+ // Set the chunk location
210
+ result.setChunk(new ChunkWrapper(worldInfo.getName(), chunkX, chunkZ));
211
+ // Set the result data
212
+ result.setChunkData(chunkData);
213
+ result.result = null;
214
+
215
+ // Catch any exceptions (as exceptions usually thrown)
216
+ try {
217
+ generate(BlockVector2.at(chunkX, chunkZ), worldInfo.getName(), result, false);
218
+ } catch (Throwable e) {
219
+ LOGGER.error("Error attempting to generate chunk.", e);
220
+ }
221
+ }
222
+
223
+ @Override
224
+ public void generateSurface(
225
+ @NotNull final WorldInfo worldInfo,
226
+ @NotNull final Random random,
227
+ final int chunkX,
228
+ final int chunkZ,
229
+ @NotNull final ChunkData chunkData
230
+ ) {
231
+ if (platformGenerator != this) {
232
+ platformGenerator.generateSurface(worldInfo, random, chunkX, chunkZ, chunkData);
233
+ }
234
+ }
235
+
236
+ @Override
237
+ public void generateBedrock(
238
+ @NotNull final WorldInfo worldInfo,
239
+ @NotNull final Random random,
240
+ final int chunkX,
241
+ final int chunkZ,
242
+ @NotNull final ChunkData chunkData
243
+ ) {
244
+ if (platformGenerator != this) {
245
+ platformGenerator.generateBedrock(worldInfo, random, chunkX, chunkZ, chunkData);
246
+ }
247
+ }
248
+
249
+ @Override
250
+ public void generateCaves(
251
+ @NotNull final WorldInfo worldInfo,
252
+ @NotNull final Random random,
253
+ final int chunkX,
254
+ final int chunkZ,
255
+ @NotNull final ChunkData chunkData
256
+ ) {
257
+ if (platformGenerator != this) {
258
+ platformGenerator.generateCaves(worldInfo, random, chunkX, chunkZ, chunkData);
259
+ }
260
+ }
261
+
262
+ @Override
263
+ public @Nullable BiomeProvider getDefaultBiomeProvider(@NotNull final WorldInfo worldInfo) {
264
+ if (platformGenerator != this) {
265
+ return platformGenerator.getDefaultBiomeProvider(worldInfo);
266
+ }
267
+ return biomeProvider;
268
+ }
269
+
270
+ @Override
271
+ public int getBaseHeight(
272
+ @NotNull final WorldInfo worldInfo,
273
+ @NotNull final Random random,
274
+ final int x,
275
+ final int z,
276
+ @NotNull final HeightMap heightMap
277
+ ) {
278
+ PlotArea area = getPlotArea(worldInfo.getName(), x, z);
279
+ if (area instanceof ClassicPlotWorld cpw) {
280
+ // Default to plot height being the heighest point before decoration (i.e. roads, walls etc.)
281
+ return cpw.PLOT_HEIGHT;
282
+ }
283
+ return super.getBaseHeight(worldInfo, random, x, z, heightMap);
284
+ }
285
+
286
+ @SuppressWarnings("deprecation") // The entire method is deprecated, but kept for compatibility with <=1.16.2
287
+ @Override
288
+ @Deprecated(since = "TODO")
171
289
  public @NonNull ChunkData generateChunkData(
172
- @NonNull World world, @NonNull Random random, int x, int z,
173
- @NonNull BiomeGrid biome
290
+ @NonNull World world, @NonNull Random random, int x, int z, @NonNull BiomeGrid biome
174
291
  ) {
292
+ if (useNewGenerationMethods) {
293
+ if (this.platformGenerator != this) {
294
+ return this.platformGenerator.generateChunkData(world, random, x, z, biome);
295
+ } else {
296
+ // Return super as it will throw an exception caught by the server that will mean this method is no longer used.
297
+ return super.generateChunkData(world, random, x, z, biome);
298
+ }
299
+ }
300
+
175
301
  int minY = BukkitWorld.getMinWorldHeight(world);
176
302
  int maxY = BukkitWorld.getMaxWorldHeight(world);
177
303
  GenChunk result = new GenChunk(minY, maxY);
@@ -181,7 +307,6 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
181
307
  for (int chunkZ = 0; chunkZ < 16; chunkZ++) {
182
308
  for (int y = minY; y < maxY; y++) {
183
309
  biome.setBiome(chunkX, y, chunkZ, Biome.PLAINS);
184
-
185
310
  }
186
311
  }
187
312
  }
@@ -201,35 +326,32 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
201
326
  if (this.platformGenerator != this) {
202
327
  return this.platformGenerator.generateChunkData(world, random, x, z, biome);
203
328
  } else {
204
- generate(BlockVector2.at(x, z), world, result);
329
+ generate(BlockVector2.at(x, z), world.getName(), result, true);
205
330
  }
206
331
  } catch (Throwable e) {
207
- e.printStackTrace();
332
+ LOGGER.error("Error attempting to load world into PlotSquared.", e);
208
333
  }
209
334
  // Return the result data
210
335
  return result.getChunkData();
211
336
  }
212
337
 
213
- private void generate(BlockVector2 loc, World world, ScopedQueueCoordinator result) {
338
+ private void generate(BlockVector2 loc, String world, ZeroedDelegateScopedQueueCoordinator result, boolean biomes) {
214
339
  // Load if improperly loaded
215
340
  if (!this.loaded) {
216
- checkLoaded(world);
341
+ synchronized (this) {
342
+ PlotSquared.get().loadWorld(world, this);
343
+ }
217
344
  }
218
345
  // Process the chunk
219
346
  if (ChunkManager.preProcessChunk(loc, result)) {
220
347
  return;
221
348
  }
222
- PlotArea area = this.plotAreaManager.getPlotArea(world.getName(), null);
223
- if (area == null && (area = this.plotAreaManager.getPlotArea(this.levelName, null)) == null) {
224
- throw new IllegalStateException(
225
- "Cannot regenerate chunk that does not belong to a plot area." + " Location: " + loc
226
- + ", world: " + world);
227
- }
349
+ PlotArea area = getPlotArea(world, loc.getX(), loc.getZ());
228
350
  try {
229
- this.plotGenerator.generateChunk(result, area);
351
+ this.plotGenerator.generateChunk(result, area, biomes);
230
352
  } catch (Throwable e) {
231
353
  // Recover from generator error
232
- e.printStackTrace();
354
+ LOGGER.error("Error attempting to generate chunk.", e);
233
355
  }
234
356
  ChunkManager.postProcessChunk(loc, result);
235
357
  }
@@ -283,4 +405,51 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
283
405
  return this.levelName;
284
406
  }
285
407
 
408
+ private synchronized PlotArea getPlotArea(String name, int chunkX, int chunkZ) {
409
+ // Load if improperly loaded
410
+ if (!this.loaded) {
411
+ PlotSquared.get().loadWorld(name, this);
412
+ // Do not set loaded to true as we want to ensure spawn limits are set when "loading" is actually able to be
413
+ // completed properly.
414
+ }
415
+ if (lastPlotArea != null && name.equals(this.levelName) && chunkX == lastChunkX && chunkZ == lastChunkZ) {
416
+ return lastPlotArea;
417
+ }
418
+ PlotArea area = UncheckedWorldLocation.at(name, chunkX << 4, 0, chunkZ << 4).getPlotArea();
419
+ if (area == null) {
420
+ throw new IllegalStateException(String.format("Cannot generate chunk that does not belong to a plot area. World: %s",
421
+ name
422
+ ));
423
+ }
424
+ this.lastChunkX = chunkX;
425
+ this.lastChunkZ = chunkZ;
426
+ return this.lastPlotArea = area;
427
+ }
428
+
429
+ /**
430
+ * Biome provider should never need to be accessed outside of this class.
431
+ */
432
+ private final class BukkitPlotBiomeProvider extends BiomeProvider {
433
+
434
+ private static final List<Biome> BIOMES;
435
+
436
+ static {
437
+ ArrayList<Biome> biomes = new ArrayList<>(List.of(Biome.values()));
438
+ biomes.remove(Biome.CUSTOM);
439
+ BIOMES = List.copyOf(biomes);
440
+ }
441
+
442
+ @Override
443
+ public @NotNull Biome getBiome(@NotNull final WorldInfo worldInfo, final int x, final int y, final int z) {
444
+ PlotArea area = getPlotArea(worldInfo.getName(), x >> 4, z >> 4);
445
+ return BukkitAdapter.adapt(plotGenerator.getBiome(area, x, y, z));
446
+ }
447
+
448
+ @Override
449
+ public @NotNull List<Biome> getBiomes(@NotNull final WorldInfo worldInfo) {
450
+ return BIOMES; // Allow all biomes
451
+ }
452
+
453
+ }
454
+
286
455
  }
Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java CHANGED
@@ -24,9 +24,10 @@ import com.plotsquared.core.generator.IndependentPlotGenerator;
24
24
  import com.plotsquared.core.location.Location;
25
25
  import com.plotsquared.core.plot.PlotArea;
26
26
  import com.plotsquared.core.plot.PlotId;
27
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
27
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
28
28
  import com.plotsquared.core.util.MathMan;
29
29
  import com.sk89q.worldedit.bukkit.BukkitAdapter;
30
+ import com.sk89q.worldedit.world.biome.BiomeType;
30
31
  import org.bukkit.World;
31
32
  import org.bukkit.block.Biome;
32
33
  import org.bukkit.generator.BlockPopulator;
@@ -49,6 +50,11 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
49
50
  public void initialize(PlotArea area) {
50
51
  }
51
52
 
53
+ @Override
54
+ public BiomeType getBiome(final PlotArea settings, final int x, final int y, final int z) {
55
+ return null;
56
+ }
57
+
52
58
  @Override
53
59
  public String getName() {
54
60
  return this.chunkGenerator.getClass().getName();
@@ -60,7 +66,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
60
66
  }
61
67
 
62
68
  @Override
63
- public void generateChunk(final ScopedQueueCoordinator result, PlotArea settings) {
69
+ public void generateChunk(final ZeroedDelegateScopedQueueCoordinator result, PlotArea settings, boolean biomes) {
64
70
  World world = BukkitUtil.getWorld(this.world);
65
71
  Location min = result.getMin();
66
72
  int chunkX = min.getX() >> 4;
Bukkit/src/main/java/com/plotsquared/bukkit/generator/LegacyBlockStatePopulator.java CHANGED
@@ -26,7 +26,7 @@ import com.plotsquared.core.location.UncheckedWorldLocation;
26
26
  import com.plotsquared.core.plot.PlotArea;
27
27
  import com.plotsquared.core.plot.world.SinglePlotArea;
28
28
  import com.plotsquared.core.queue.QueueCoordinator;
29
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
29
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
30
30
  import com.sk89q.worldedit.bukkit.BukkitWorld;
31
31
  import com.sk89q.worldedit.util.SideEffectSet;
32
32
  import org.bukkit.Chunk;
@@ -65,7 +65,7 @@ final class LegacyBlockStatePopulator extends BlockPopulator {
65
65
  queue.setChunkObject(source);
66
66
  Location min = UncheckedWorldLocation.at(world.getName(), chunkMinX, world.getMinHeight(), chunkMinZ);
67
67
  Location max = UncheckedWorldLocation.at(world.getName(), chunkMinX + 15, world.getMaxHeight(), chunkMinZ + 15);
68
- ScopedQueueCoordinator offsetChunkQueue = new ScopedQueueCoordinator(queue, min, max);
68
+ ZeroedDelegateScopedQueueCoordinator offsetChunkQueue = new ZeroedDelegateScopedQueueCoordinator(queue, min, max);
69
69
  this.plotGenerator.populateChunk(offsetChunkQueue, area);
70
70
  queue.enqueue();
71
71
  }
Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java CHANGED
@@ -61,11 +61,12 @@ import com.plotsquared.core.util.task.TaskTime;
61
61
  import com.sk89q.worldedit.WorldEdit;
62
62
  import com.sk89q.worldedit.bukkit.BukkitAdapter;
63
63
  import com.sk89q.worldedit.world.block.BlockType;
64
- import net.kyori.adventure.text.minimessage.Template;
64
+ import net.kyori.adventure.text.Component;
65
+ import net.kyori.adventure.text.minimessage.tag.Tag;
66
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
65
67
  import org.bukkit.Bukkit;
66
68
  import org.bukkit.GameMode;
67
69
  import org.bukkit.Material;
68
- import org.bukkit.Tag;
69
70
  import org.bukkit.block.Block;
70
71
  import org.bukkit.block.BlockFace;
71
72
  import org.bukkit.block.BlockState;
@@ -112,6 +113,10 @@ import java.util.UUID;
112
113
  import java.util.stream.Collectors;
113
114
  import java.util.stream.Stream;
114
115
 
116
+ import static org.bukkit.Tag.CORALS;
117
+ import static org.bukkit.Tag.CORAL_BLOCKS;
118
+ import static org.bukkit.Tag.WALL_CORALS;
119
+
115
120
  @SuppressWarnings("unused")
116
121
  public class BlockEventListener implements Listener {
117
122
 
@@ -274,13 +279,23 @@ public class BlockEventListener implements Listener {
274
279
  if (plot != null) {
275
280
  if (area.notifyIfOutsideBuildArea(pp, location.getY())) {
276
281
  event.setCancelled(true);
282
+ pp.sendMessage(
283
+ TranslatableCaption.of("height.height_limit"),
284
+ TagResolver.builder()
285
+ .tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
286
+ .tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
287
+ .build()
288
+ );
277
289
  return;
278
290
  }
279
291
  if (!plot.hasOwner()) {
280
292
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
281
293
  pp.sendMessage(
282
294
  TranslatableCaption.of("permission.no_permission_event"),
283
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
295
+ TagResolver.resolver(
296
+ "node",
297
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)
298
+ )
284
299
  );
285
300
  event.setCancelled(true);
286
301
  return;
@@ -297,7 +312,10 @@ public class BlockEventListener implements Listener {
297
312
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
298
313
  pp.sendMessage(
299
314
  TranslatableCaption.of("permission.no_permission_event"),
300
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
315
+ TagResolver.resolver(
316
+ "node",
317
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_OTHER)
318
+ )
301
319
  );
302
320
  event.setCancelled(true);
303
321
  plot.debug(player.getName() + " could not place " + event.getBlock().getType()
@@ -324,7 +342,10 @@ public class BlockEventListener implements Listener {
324
342
  } else if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
325
343
  pp.sendMessage(
326
344
  TranslatableCaption.of("permission.no_permission_event"),
327
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
345
+ TagResolver.resolver(
346
+ "node",
347
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD)
348
+ )
328
349
  );
329
350
  event.setCancelled(true);
330
351
  }
@@ -346,13 +367,23 @@ public class BlockEventListener implements Listener {
346
367
  if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
347
368
  plotPlayer.sendMessage(
348
369
  TranslatableCaption.of("permission.no_permission_event"),
349
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL))
370
+ TagResolver.resolver(
371
+ "node",
372
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)
373
+ )
350
374
  );
351
375
  event.setCancelled(true);
352
376
  return;
353
377
  }
354
378
  } else if (area.notifyIfOutsideBuildArea(plotPlayer, location.getY())) {
355
379
  event.setCancelled(true);
380
+ plotPlayer.sendMessage(
381
+ TranslatableCaption.of("height.height_limit"),
382
+ TagResolver.builder()
383
+ .tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
384
+ .tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
385
+ .build()
386
+ );
356
387
  return;
357
388
  }
358
389
  if (!plot.hasOwner()) {
@@ -375,7 +406,10 @@ public class BlockEventListener implements Listener {
375
406
  }
376
407
  plotPlayer.sendMessage(
377
408
  TranslatableCaption.of("permission.no_permission_event"),
378
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
409
+ TagResolver.resolver(
410
+ "node",
411
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_OTHER)
412
+ )
379
413
  );
380
414
  event.setCancelled(true);
381
415
  } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
@@ -401,7 +435,10 @@ public class BlockEventListener implements Listener {
401
435
  }
402
436
  pp.sendMessage(
403
437
  TranslatableCaption.of("permission.no_permission_event"),
404
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
438
+ TagResolver.resolver(
439
+ "node",
440
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_ROAD)
441
+ )
405
442
  );
406
443
  event.setCancelled(true);
407
444
  }
@@ -534,14 +571,14 @@ public class BlockEventListener implements Listener {
534
571
  event.setCancelled(true);
535
572
  return;
536
573
  }
537
- if (SNOW.contains(event.getNewState().getType())) {
574
+ if (org.bukkit.Tag.SNOW.isTagged(event.getNewState().getType())) {
538
575
  if (!plot.getFlag(SnowFormFlag.class)) {
539
576
  plot.debug("Snow could not form because snow-form = false");
540
577
  event.setCancelled(true);
541
578
  }
542
579
  return;
543
580
  }
544
- if (Tag.ICE.isTagged(event.getNewState().getType())) {
581
+ if (org.bukkit.Tag.ICE.isTagged(event.getNewState().getType())) {
545
582
  if (!plot.getFlag(IceFormFlag.class)) {
546
583
  plot.debug("Ice could not form because ice-form = false");
547
584
  event.setCancelled(true);
@@ -566,9 +603,9 @@ public class BlockEventListener implements Listener {
566
603
  return;
567
604
  }
568
605
  Class<? extends BooleanFlag<?>> flag;
569
- if (SNOW.contains(event.getNewState().getType())) {
606
+ if (org.bukkit.Tag.SNOW.isTagged(event.getNewState().getType())) {
570
607
  flag = SnowFormFlag.class;
571
- } else if (Tag.ICE.isTagged(event.getNewState().getType())) {
608
+ } else if (org.bukkit.Tag.ICE.isTagged(event.getNewState().getType())) {
572
609
  flag = IceFormFlag.class;
573
610
  } else {
574
611
  return;
@@ -674,14 +711,14 @@ public class BlockEventListener implements Listener {
674
711
  return;
675
712
  }
676
713
  Material blockType = block.getType();
677
- if (Tag.ICE.isTagged(blockType)) {
714
+ if (org.bukkit.Tag.ICE.isTagged(blockType)) {
678
715
  if (!plot.getFlag(IceMeltFlag.class)) {
679
716
  plot.debug("Ice could not melt because ice-melt = false");
680
717
  event.setCancelled(true);
681
718
  }
682
719
  return;
683
720
  }
684
- if (SNOW.contains(blockType)) {
721
+ if (org.bukkit.Tag.SNOW.isTagged(blockType)) {
685
722
  if (!plot.getFlag(SnowMeltFlag.class)) {
686
723
  plot.debug("Snow could not melt because snow-melt = false");
687
724
  event.setCancelled(true);
@@ -695,7 +732,7 @@ public class BlockEventListener implements Listener {
695
732
  }
696
733
  return;
697
734
  }
698
- if (Tag.CORAL_BLOCKS.isTagged(blockType) || Tag.CORALS.isTagged(blockType) || Tag.WALL_CORALS.isTagged(blockType)) {
735
+ if (CORAL_BLOCKS.isTagged(blockType) || CORALS.isTagged(blockType) || WALL_CORALS.isTagged(blockType)) {
699
736
  if (!plot.getFlag(CoralDryFlag.class)) {
700
737
  plot.debug("Coral could not dry because coral-dry = false");
701
738
  event.setCancelled(true);
@@ -748,7 +785,10 @@ public class BlockEventListener implements Listener {
748
785
  }
749
786
 
750
787
  if (toPlot != null) {
751
- if (!toArea.contains(fromLocation.getX(), fromLocation.getZ()) || !Objects.equals(toPlot, toArea.getOwnedPlot(fromLocation))) {
788
+ if (!toArea.contains(fromLocation.getX(), fromLocation.getZ()) || !Objects.equals(
789
+ toPlot,
790
+ toArea.getOwnedPlot(fromLocation)
791
+ )) {
752
792
  event.setCancelled(true);
753
793
  return;
754
794
  }
@@ -764,7 +804,10 @@ public class BlockEventListener implements Listener {
764
804
  toPlot.debug("Liquid could not flow because liquid-flow = disabled");
765
805
  event.setCancelled(true);
766
806
  }
767
- } else if (!toArea.contains(fromLocation.getX(), fromLocation.getZ()) || !Objects.equals(null, toArea.getOwnedPlot(fromLocation))) {
807
+ } else if (!toArea.contains(fromLocation.getX(), fromLocation.getZ()) || !Objects.equals(
808
+ null,
809
+ toArea.getOwnedPlot(fromLocation)
810
+ )) {
768
811
  event.setCancelled(true);
769
812
  } else if (event.getBlock().isLiquid()) {
770
813
  final org.bukkit.Location location = event.getBlock().getLocation();
@@ -1087,7 +1130,10 @@ public class BlockEventListener implements Listener {
1087
1130
  )) {
1088
1131
  pp.sendMessage(
1089
1132
  TranslatableCaption.of("permission.no_permission_event"),
1090
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
1133
+ TagResolver.resolver(
1134
+ "node",
1135
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD)
1136
+ )
1091
1137
  );
1092
1138
  event.setCancelled(true);
1093
1139
  }
@@ -1097,7 +1143,10 @@ public class BlockEventListener implements Listener {
1097
1143
  )) {
1098
1144
  pp.sendMessage(
1099
1145
  TranslatableCaption.of("permission.no_permission_event"),
1100
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
1146
+ TagResolver.resolver(
1147
+ "node",
1148
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)
1149
+ )
1101
1150
  );
1102
1151
  event.setCancelled(true);
1103
1152
  }
@@ -1105,7 +1154,10 @@ public class BlockEventListener implements Listener {
1105
1154
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
1106
1155
  pp.sendMessage(
1107
1156
  TranslatableCaption.of("permission.no_permission_event"),
1108
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
1157
+ TagResolver.resolver(
1158
+ "node",
1159
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_OTHER)
1160
+ )
1109
1161
  );
1110
1162
  event.setCancelled(true);
1111
1163
  }
@@ -1231,16 +1283,29 @@ public class BlockEventListener implements Listener {
1231
1283
  ) && !(Objects.equals(currentLocation.getPlot(), plot))) {
1232
1284
  pp.sendMessage(
1233
1285
  TranslatableCaption.of("permission.no_permission_event"),
1234
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
1286
+ TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD))
1235
1287
  );
1236
1288
  event.setCancelled(true);
1237
1289
  break;
1238
1290
  }
1239
- if (area.notifyIfOutsideBuildArea(pp, currentLocation.getY())) {
1240
- event.setCancelled(true);
1241
- break;
1291
+ if (pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
1292
+ continue;
1293
+ }
1294
+ if (currentLocation.getY() >= area.getMaxBuildHeight() || currentLocation.getY() < area.getMinBuildHeight()) {
1295
+ pp.sendMessage(
1296
+ TranslatableCaption.of("height.height_limit"),
1297
+ TagResolver.builder()
1298
+ .tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
1299
+ .tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
1300
+ .build()
1301
+ );
1302
+ if (area.notifyIfOutsideBuildArea(pp, currentLocation.getY())) {
1303
+ event.setCancelled(true);
1304
+ break;
1305
+ }
1242
1306
  }
1243
1307
  }
1308
+
1244
1309
  }
1245
1310
 
1246
1311
  }
Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java CHANGED
@@ -43,8 +43,10 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
43
43
  import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
44
44
  import com.plotsquared.core.plot.flag.types.BooleanFlag;
45
45
  import com.plotsquared.core.plot.world.PlotAreaManager;
46
+ import net.kyori.adventure.text.Component;
47
+ import net.kyori.adventure.text.minimessage.tag.Tag;
48
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
46
49
  import com.plotsquared.core.util.PlotFlagUtil;
47
- import net.kyori.adventure.text.minimessage.Template;
48
50
  import org.bukkit.Chunk;
49
51
  import org.bukkit.block.Block;
50
52
  import org.bukkit.block.TileState;
@@ -302,7 +304,7 @@ public class PaperListener implements Listener {
302
304
  final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
303
305
  plotPlayer.sendMessage(
304
306
  TranslatableCaption.of("errors.tile_entity_cap_reached"),
305
- Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
307
+ TagResolver.resolver("amount", Tag.inserting(Component.text(Settings.Chunk_Processor.MAX_TILES)))
306
308
  );
307
309
  event.setCancelled(true);
308
310
  event.setBuild(false);
@@ -339,7 +341,10 @@ public class PaperListener implements Listener {
339
341
  )) {
340
342
  pp.sendMessage(
341
343
  TranslatableCaption.of("permission.no_permission_event"),
342
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
344
+ TagResolver.resolver(
345
+ "node",
346
+ Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)
347
+ )
343
348
  );
344
349
  entity.remove();
345
350
  event.setCancelled(true);
@@ -348,7 +353,10 @@ public class PaperListener implements Listener {
348
353
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
349
354
  pp.sendMessage(
350
355
  TranslatableCaption.of("permission.no_permission_event"),
351
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
356
+ TagResolver.resolver(
357
+ "node",
358
+ Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)
359
+ )
352
360
  );
353
361
  entity.remove();
354
362
  event.setCancelled(true);
@@ -358,7 +366,10 @@ public class PaperListener implements Listener {
358
366
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
359
367
  pp.sendMessage(
360
368
  TranslatableCaption.of("permission.no_permission_event"),
361
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
369
+ TagResolver.resolver(
370
+ "node",
371
+ Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)
372
+ )
362
373
  );
363
374
  entity.remove();
364
375
  event.setCancelled(true);
Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener113.java DELETED
@@ -1,91 +0,0 @@
1
- /*
2
- * PlotSquared, a land and world management plugin for Minecraft.
3
- * Copyright (C) IntellectualSites <https://intellectualsites.com>
4
- * Copyright (C) IntellectualSites team and contributors
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- */
19
- package com.plotsquared.bukkit.listener;
20
-
21
- import com.google.inject.Inject;
22
- import com.plotsquared.bukkit.util.BukkitUtil;
23
- import com.plotsquared.core.configuration.Settings;
24
- import com.plotsquared.core.configuration.caption.TranslatableCaption;
25
- import com.plotsquared.core.location.Location;
26
- import com.plotsquared.core.player.PlotPlayer;
27
- import com.plotsquared.core.plot.PlotArea;
28
- import com.plotsquared.core.plot.world.PlotAreaManager;
29
- import net.kyori.adventure.text.minimessage.Template;
30
- import org.bukkit.block.Banner;
31
- import org.bukkit.block.Beacon;
32
- import org.bukkit.block.BlockState;
33
- import org.bukkit.block.CommandBlock;
34
- import org.bukkit.block.Comparator;
35
- import org.bukkit.block.Conduit;
36
- import org.bukkit.block.Container;
37
- import org.bukkit.block.CreatureSpawner;
38
- import org.bukkit.block.DaylightDetector;
39
- import org.bukkit.block.EnchantingTable;
40
- import org.bukkit.block.EndGateway;
41
- import org.bukkit.block.EnderChest;
42
- import org.bukkit.block.Jukebox;
43
- import org.bukkit.block.Sign;
44
- import org.bukkit.block.Skull;
45
- import org.bukkit.block.Structure;
46
- import org.bukkit.block.data.type.Bed;
47
- import org.bukkit.event.EventHandler;
48
- import org.bukkit.event.block.BlockPlaceEvent;
49
- import org.checkerframework.checker.nullness.qual.NonNull;
50
-
51
- /**
52
- * @deprecated P2 effectively no longer supports 1.13
53
- */
54
- @Deprecated(forRemoval = true, since = "6.10.4")
55
- public class PaperListener113 extends PaperListener {
56
-
57
- @Inject
58
- public PaperListener113(@NonNull PlotAreaManager plotAreaManager) {
59
- super(plotAreaManager);
60
- }
61
-
62
- @EventHandler
63
- public void onBlockPlace(BlockPlaceEvent event) {
64
- if (!Settings.Paper_Components.TILE_ENTITY_CHECK || !Settings.Enabled_Components.CHUNK_PROCESSOR) {
65
- return;
66
- }
67
- BlockState state = event.getBlock().getState(false);
68
- if (!(state instanceof Banner || state instanceof Beacon || state instanceof Bed || state instanceof CommandBlock
69
- || state instanceof Comparator || state instanceof Conduit || state instanceof Container || state instanceof CreatureSpawner
70
- || state instanceof DaylightDetector || state instanceof EnchantingTable || state instanceof EnderChest || state instanceof EndGateway
71
- || state instanceof Jukebox || state instanceof Sign || state instanceof Skull || state instanceof Structure)) {
72
- return;
73
- }
74
- final Location location = BukkitUtil.adapt(event.getBlock().getLocation());
75
- final PlotArea plotArea = location.getPlotArea();
76
- if (plotArea == null) {
77
- return;
78
- }
79
- final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length;
80
- if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
81
- final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
82
- plotPlayer.sendMessage(
83
- TranslatableCaption.of("errors.tile_entity_cap_reached"),
84
- Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
85
- );
86
- event.setCancelled(true);
87
- event.setBuild(false);
88
- }
89
- }
90
-
91
- }
Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java CHANGED
@@ -77,12 +77,13 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
77
77
  import com.sk89q.worldedit.world.block.BlockType;
78
78
  import io.papermc.lib.PaperLib;
79
79
  import net.kyori.adventure.text.Component;
80
- import net.kyori.adventure.text.minimessage.Template;
80
+ import net.kyori.adventure.text.minimessage.MiniMessage;
81
+ import net.kyori.adventure.text.minimessage.tag.Tag;
82
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
83
+ import net.kyori.adventure.text.minimessage.tag.standard.StandardTags;
81
84
  import org.bukkit.Bukkit;
82
- import org.bukkit.ChatColor;
83
85
  import org.bukkit.FluidCollisionMode;
84
86
  import org.bukkit.Material;
85
- import org.bukkit.Tag;
86
87
  import org.bukkit.block.Block;
87
88
  import org.bukkit.block.BlockFace;
88
89
  import org.bukkit.block.BlockState;
@@ -398,11 +399,15 @@ public class PlayerEventListener implements Listener {
398
399
  && PremiumVerification.isPremium() && UpdateUtility.hasUpdate) {
399
400
  Caption boundary = TranslatableCaption.of("update.update_boundary");
400
401
  Caption updateNotification = TranslatableCaption.of("update.update_notification");
401
- Template internalVersion = Template.of("p2version", UpdateUtility.internalVersion.versionString());
402
- Template spigotVersion = Template.of("spigotversion", UpdateUtility.spigotVersion);
403
- Template downloadUrl = Template.of("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
404
402
  pp.sendMessage(boundary);
405
- pp.sendMessage(updateNotification, internalVersion, spigotVersion, downloadUrl);
403
+ pp.sendMessage(
404
+ updateNotification,
405
+ TagResolver.builder()
406
+ .tag("p2version", Tag.inserting(Component.text(UpdateUtility.internalVersion.versionString())))
407
+ .tag("spigotversion", Tag.inserting(Component.text(UpdateUtility.spigotVersion)))
408
+ .tag("downloadurl", Tag.preProcessParsed("https://www.spigotmc.org/resources/77506/updates"))
409
+ .build()
410
+ );
406
411
  pp.sendMessage(boundary);
407
412
  }
408
413
  }
@@ -454,7 +459,7 @@ public class PlayerEventListener implements Listener {
454
459
  .equals(BukkitUtil.adaptComplete(to)))) {
455
460
  pp.sendMessage(
456
461
  TranslatableCaption.of("deny.no_enter"),
457
- Template.of("plot", plot.toString())
462
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
458
463
  );
459
464
  event.setCancelled(true);
460
465
  }
@@ -570,7 +575,10 @@ public class PlayerEventListener implements Listener {
570
575
  if (lastPlot != null && !plotListener.plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
571
576
  pp.sendMessage(
572
577
  TranslatableCaption.of("permission.no_permission_event"),
573
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
578
+ TagResolver.resolver(
579
+ "node",
580
+ Tag.inserting(Permission.PERMISSION_ADMIN_EXIT_DENIED)
581
+ )
574
582
  );
575
583
  this.tmpTeleport = false;
576
584
  if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
@@ -588,7 +596,7 @@ public class PlayerEventListener implements Listener {
588
596
  } else if (!plotListener.plotEntry(pp, now) && this.tmpTeleport) {
589
597
  pp.sendMessage(
590
598
  TranslatableCaption.of("deny.no_enter"),
591
- Template.of("plot", now.toString())
599
+ TagResolver.resolver("plot", Tag.inserting(Component.text(now.toString())))
592
600
  );
593
601
  this.tmpTeleport = false;
594
602
  to.setX(from.getBlockX());
@@ -660,7 +668,10 @@ public class PlayerEventListener implements Listener {
660
668
  if (lastPlot != null && !plotListener.plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
661
669
  pp.sendMessage(
662
670
  TranslatableCaption.of("permission.no_permission_event"),
663
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
671
+ TagResolver.resolver(
672
+ "node",
673
+ Tag.inserting(Permission.PERMISSION_ADMIN_EXIT_DENIED)
674
+ )
664
675
  );
665
676
  this.tmpTeleport = false;
666
677
  if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
@@ -678,7 +689,7 @@ public class PlayerEventListener implements Listener {
678
689
  } else if (!plotListener.plotEntry(pp, plot) && this.tmpTeleport) {
679
690
  pp.sendMessage(
680
691
  TranslatableCaption.of("deny.no_enter"),
681
- Template.of("plot", plot.toString())
692
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
682
693
  );
683
694
  this.tmpTeleport = false;
684
695
  player.teleport(from);
@@ -762,46 +773,34 @@ public class PlayerEventListener implements Listener {
762
773
  PlotId id = plot.getId();
763
774
  String worldName = plot.getWorldName();
764
775
  Caption msg = TranslatableCaption.of("chat.plot_chat_format");
765
- Template msgTemplate;
766
- Template worldNameTemplate = Template.of("world", worldName);
767
- Template plotTemplate = Template.of("plot_id", id.toString());
768
- Template senderTemplate = Template.of("sender", sender);
769
- // If we do/don't want colour, we need to be careful about how to go about it, as players could attempt either <gold></gold> or &6 etc.
770
- // In both cases, we want to use a Component Template to ensure that the player cannot use any placeholders in their message on purpose
771
- // or accidentally, as component templates are done at the end. We also need to deserialize from legacy color codes to a Component if
772
- // allowing colour.
776
+ TagResolver.Builder builder = TagResolver.builder();
777
+ builder.tag("world", Tag.inserting(Component.text(worldName)));
778
+ builder.tag("plot_id", Tag.inserting(Component.text(id.toString())));
779
+ builder.tag("sender", Tag.inserting(Component.text(sender)));
773
780
  if (plotPlayer.hasPermission("plots.chat.color")) {
774
- msgTemplate = Template
775
- .of(
776
- "msg",
777
- BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes(
778
- '&',
779
- message
780
- ))
781
- );
781
+ builder.tag("msg", Tag.inserting(MiniMessage.miniMessage().deserialize(
782
+ message,
783
+ TagResolver.resolver(StandardTags.color(), StandardTags.gradient(),
784
+ StandardTags.rainbow(), StandardTags.decorations()
785
+ )
786
+ )));
782
787
  } else {
783
- msgTemplate = Template.of("msg", BukkitUtil.MINI_MESSAGE.deserialize(
784
- ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))));
788
+ builder.tag("msg", Tag.inserting(Component.text(message)));
785
789
  }
786
790
  for (PlotPlayer<?> receiver : plotRecipients) {
787
- receiver.sendMessage(msg, worldNameTemplate, msgTemplate, plotTemplate, senderTemplate);
791
+ receiver.sendMessage(msg, builder.build());
788
792
  }
789
793
  if (!spies.isEmpty()) {
790
794
  Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
791
- Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
792
- Template spysenderTemplate = Template.of("sender", sender);
793
- Template spymessageTemplate = Template.of("msg", Component.text(message));
794
795
  for (PlotPlayer<?> player : spies) {
795
- player.sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, spymessageTemplate);
796
+ player.sendMessage(spymsg, builder.tag("message", Tag.inserting(Component.text(message))).build());
796
797
  }
797
798
  }
798
799
  if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) {
799
800
  Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
800
- Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
801
- Template spysenderTemplate = Template.of("sender", sender);
802
- Template spymessageTemplate = Template.of("msg", Component.text(message));
803
- ConsolePlayer.getConsole().sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate,
804
- spymessageTemplate
801
+ ConsolePlayer.getConsole().sendMessage(
802
+ spymsg,
803
+ builder.tag("message", Tag.inserting(Component.text(message))).build()
805
804
  );
806
805
  }
807
806
  }
@@ -945,7 +944,10 @@ public class PlayerEventListener implements Listener {
945
944
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
946
945
  pp.sendMessage(
947
946
  TranslatableCaption.of("permission.no_permission_event"),
948
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
947
+ TagResolver.resolver(
948
+ "node",
949
+ Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_ROAD)
950
+ )
949
951
  );
950
952
  cancelled = true;
951
953
  }
@@ -953,7 +955,10 @@ public class PlayerEventListener implements Listener {
953
955
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
954
956
  pp.sendMessage(
955
957
  TranslatableCaption.of("permission.no_permission_event"),
956
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
958
+ TagResolver.resolver(
959
+ "node",
960
+ Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)
961
+ )
957
962
  );
958
963
  cancelled = true;
959
964
  }
@@ -963,7 +968,10 @@ public class PlayerEventListener implements Listener {
963
968
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
964
969
  pp.sendMessage(
965
970
  TranslatableCaption.of("permission.no_permission_event"),
966
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
971
+ TagResolver.resolver(
972
+ "node",
973
+ Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_OTHER)
974
+ )
967
975
  );
968
976
  cancelled = true;
969
977
  }
@@ -1002,7 +1010,10 @@ public class PlayerEventListener implements Listener {
1002
1010
  )) {
1003
1011
  pp.sendMessage(
1004
1012
  TranslatableCaption.of("permission.no_permission_event"),
1005
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
1013
+ TagResolver.resolver(
1014
+ "node",
1015
+ Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_ROAD)
1016
+ )
1006
1017
  );
1007
1018
  e.setCancelled(true);
1008
1019
  }
@@ -1018,7 +1029,10 @@ public class PlayerEventListener implements Listener {
1018
1029
  if (!pp.hasPermission("plots.admin.interact.unowned")) {
1019
1030
  pp.sendMessage(
1020
1031
  TranslatableCaption.of("permission.no_permission_event"),
1021
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
1032
+ TagResolver.resolver(
1033
+ "node",
1034
+ Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)
1035
+ )
1022
1036
  );
1023
1037
  e.setCancelled(true);
1024
1038
  }
@@ -1033,7 +1047,10 @@ public class PlayerEventListener implements Listener {
1033
1047
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
1034
1048
  pp.sendMessage(
1035
1049
  TranslatableCaption.of("permission.no_permission_event"),
1036
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
1050
+ TagResolver.resolver(
1051
+ "node",
1052
+ Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_OTHER)
1053
+ )
1037
1054
  );
1038
1055
  e.setCancelled(true);
1039
1056
  plot.debug(pp.getName() + " could not interact with " + entity.getType()
@@ -1160,7 +1177,7 @@ public class PlayerEventListener implements Listener {
1160
1177
  location = BukkitUtil.adapt(block.getRelative(event.getBlockFace()).getLocation());
1161
1178
  eventType = PlayerBlockEventType.PLACE_MISC;
1162
1179
  }
1163
- if (Tag.ITEMS_BOATS.isTagged(type) || MINECARTS.contains(type)) {
1180
+ if (org.bukkit.Tag.ITEMS_BOATS.isTagged(type) || MINECARTS.contains(type)) {
1164
1181
  eventType = PlayerBlockEventType.PLACE_VEHICLE;
1165
1182
  break;
1166
1183
  }
@@ -1260,7 +1277,7 @@ public class PlayerEventListener implements Listener {
1260
1277
  }
1261
1278
  pp.sendMessage(
1262
1279
  TranslatableCaption.of("permission.no_permission_event"),
1263
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
1280
+ TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD))
1264
1281
  );
1265
1282
  event.setCancelled(true);
1266
1283
  } else if (!plot.hasOwner()) {
@@ -1269,7 +1286,10 @@ public class PlayerEventListener implements Listener {
1269
1286
  }
1270
1287
  pp.sendMessage(
1271
1288
  TranslatableCaption.of("permission.no_permission_event"),
1272
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
1289
+ TagResolver.resolver(
1290
+ "node",
1291
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)
1292
+ )
1273
1293
  );
1274
1294
  event.setCancelled(true);
1275
1295
  } else if (!plot.isAdded(pp.getUUID())) {
@@ -1278,7 +1298,10 @@ public class PlayerEventListener implements Listener {
1278
1298
  }
1279
1299
  pp.sendMessage(
1280
1300
  TranslatableCaption.of("permission.no_permission_event"),
1281
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
1301
+ TagResolver.resolver(
1302
+ "node",
1303
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_OTHER)
1304
+ )
1282
1305
  );
1283
1306
  event.setCancelled(true);
1284
1307
  } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
@@ -1325,7 +1348,7 @@ public class PlayerEventListener implements Listener {
1325
1348
  }
1326
1349
  plotPlayer.sendMessage(
1327
1350
  TranslatableCaption.of("permission.no_permission_event"),
1328
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
1351
+ TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD))
1329
1352
  );
1330
1353
  event.setCancelled(true);
1331
1354
  } else if (!plot.hasOwner()) {
@@ -1334,7 +1357,10 @@ public class PlayerEventListener implements Listener {
1334
1357
  }
1335
1358
  plotPlayer.sendMessage(
1336
1359
  TranslatableCaption.of("permission.no_permission_event"),
1337
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
1360
+ TagResolver.resolver(
1361
+ "node",
1362
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)
1363
+ )
1338
1364
  );
1339
1365
  event.setCancelled(true);
1340
1366
  } else if (!plot.isAdded(plotPlayer.getUUID())) {
@@ -1343,7 +1369,10 @@ public class PlayerEventListener implements Listener {
1343
1369
  }
1344
1370
  plotPlayer.sendMessage(
1345
1371
  TranslatableCaption.of("permission.no_permission_event"),
1346
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
1372
+ TagResolver.resolver(
1373
+ "node",
1374
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_OTHER)
1375
+ )
1347
1376
  );
1348
1377
  event.setCancelled(true);
1349
1378
  } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
@@ -1375,7 +1404,10 @@ public class PlayerEventListener implements Listener {
1375
1404
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
1376
1405
  pp.sendMessage(
1377
1406
  TranslatableCaption.of("permission.no_permission_event"),
1378
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
1407
+ TagResolver.resolver(
1408
+ "node",
1409
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD)
1410
+ )
1379
1411
  );
1380
1412
  event.setCancelled(true);
1381
1413
  }
@@ -1384,7 +1416,10 @@ public class PlayerEventListener implements Listener {
1384
1416
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
1385
1417
  pp.sendMessage(
1386
1418
  TranslatableCaption.of("permission.no_permission_event"),
1387
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
1419
+ TagResolver.resolver(
1420
+ "node",
1421
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)
1422
+ )
1388
1423
  );
1389
1424
  event.setCancelled(true);
1390
1425
  }
@@ -1395,7 +1430,10 @@ public class PlayerEventListener implements Listener {
1395
1430
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
1396
1431
  pp.sendMessage(
1397
1432
  TranslatableCaption.of("permission.no_permission_event"),
1398
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
1433
+ TagResolver.resolver(
1434
+ "node",
1435
+ Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_OTHER)
1436
+ )
1399
1437
  );
1400
1438
  event.setCancelled(true);
1401
1439
  }
@@ -1424,7 +1462,10 @@ public class PlayerEventListener implements Listener {
1424
1462
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
1425
1463
  pp.sendMessage(
1426
1464
  TranslatableCaption.of("permission.no_permission_event"),
1427
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
1465
+ TagResolver.resolver(
1466
+ "node",
1467
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_ROAD)
1468
+ )
1428
1469
  );
1429
1470
  event.setCancelled(true);
1430
1471
  }
@@ -1432,7 +1473,10 @@ public class PlayerEventListener implements Listener {
1432
1473
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
1433
1474
  pp.sendMessage(
1434
1475
  TranslatableCaption.of("permission.no_permission_event"),
1435
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
1476
+ TagResolver.resolver(
1477
+ "node",
1478
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)
1479
+ )
1436
1480
  );
1437
1481
  event.setCancelled(true);
1438
1482
  }
@@ -1443,7 +1487,10 @@ public class PlayerEventListener implements Listener {
1443
1487
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
1444
1488
  pp.sendMessage(
1445
1489
  TranslatableCaption.of("permission.no_permission_event"),
1446
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
1490
+ TagResolver.resolver(
1491
+ "node",
1492
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_OTHER)
1493
+ )
1447
1494
  );
1448
1495
  event.setCancelled(true);
1449
1496
  plot.debug(p.getName()
@@ -1464,7 +1511,10 @@ public class PlayerEventListener implements Listener {
1464
1511
  if (!player.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
1465
1512
  player.sendMessage(
1466
1513
  TranslatableCaption.of("permission.no_permission_event"),
1467
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
1514
+ TagResolver.resolver(
1515
+ "node",
1516
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)
1517
+ )
1468
1518
  );
1469
1519
  event.setCancelled(true);
1470
1520
  }
@@ -1473,7 +1523,10 @@ public class PlayerEventListener implements Listener {
1473
1523
  if (!player.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
1474
1524
  player.sendMessage(
1475
1525
  TranslatableCaption.of("permission.no_permission_event"),
1476
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
1526
+ TagResolver.resolver(
1527
+ "node",
1528
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_OTHER)
1529
+ )
1477
1530
  );
1478
1531
  event.setCancelled(true);
1479
1532
  plot.debug(player.getName()
@@ -1505,7 +1558,10 @@ public class PlayerEventListener implements Listener {
1505
1558
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
1506
1559
  pp.sendMessage(
1507
1560
  TranslatableCaption.of("permission.no_permission_event"),
1508
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
1561
+ TagResolver.resolver(
1562
+ "node",
1563
+ Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_ROAD)
1564
+ )
1509
1565
  );
1510
1566
  event.setCancelled(true);
1511
1567
  }
@@ -1513,7 +1569,10 @@ public class PlayerEventListener implements Listener {
1513
1569
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
1514
1570
  pp.sendMessage(
1515
1571
  TranslatableCaption.of("permission.no_permission_event"),
1516
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
1572
+ TagResolver.resolver(
1573
+ "node",
1574
+ Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)
1575
+ )
1517
1576
  );
1518
1577
  event.setCancelled(true);
1519
1578
  }
@@ -1571,7 +1630,10 @@ public class PlayerEventListener implements Listener {
1571
1630
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
1572
1631
  pp.sendMessage(
1573
1632
  TranslatableCaption.of("permission.no_permission_event"),
1574
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
1633
+ TagResolver.resolver(
1634
+ "node",
1635
+ Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_OTHER)
1636
+ )
1575
1637
  );
1576
1638
  event.setCancelled(true);
1577
1639
  }
@@ -1595,7 +1657,10 @@ public class PlayerEventListener implements Listener {
1595
1657
  )) {
1596
1658
  pp.sendMessage(
1597
1659
  TranslatableCaption.of("permission.no_permission_event"),
1598
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD))
1660
+ TagResolver.resolver(
1661
+ "node",
1662
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)
1663
+ )
1599
1664
  );
1600
1665
  event.setCancelled(true);
1601
1666
  }
@@ -1604,7 +1669,10 @@ public class PlayerEventListener implements Listener {
1604
1669
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) {
1605
1670
  pp.sendMessage(
1606
1671
  TranslatableCaption.of("permission.no_permission_event"),
1607
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED))
1672
+ TagResolver.resolver(
1673
+ "node",
1674
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)
1675
+ )
1608
1676
  );
1609
1677
  event.setCancelled(true);
1610
1678
  return;
@@ -1618,7 +1686,10 @@ public class PlayerEventListener implements Listener {
1618
1686
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) {
1619
1687
  pp.sendMessage(
1620
1688
  TranslatableCaption.of("permission.no_permission_event"),
1621
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER))
1689
+ TagResolver.resolver(
1690
+ "node",
1691
+ Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)
1692
+ )
1622
1693
  );
1623
1694
  event.setCancelled(true);
1624
1695
  plot.debug(pp.getName()
Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java CHANGED
@@ -30,8 +30,9 @@ import com.plotsquared.core.plot.PlotArea;
30
30
  import com.plotsquared.core.plot.PlotHandler;
31
31
  import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
32
32
  import com.plotsquared.core.plot.world.PlotAreaManager;
33
+ import net.kyori.adventure.text.minimessage.tag.Tag;
34
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
33
35
  import com.plotsquared.core.util.PlotFlagUtil;
34
- import net.kyori.adventure.text.minimessage.Template;
35
36
  import org.bukkit.entity.Entity;
36
37
  import org.bukkit.entity.LivingEntity;
37
38
  import org.bukkit.entity.Player;
@@ -110,7 +111,10 @@ public class ProjectileEventListener implements Listener {
110
111
  )) {
111
112
  pp.sendMessage(
112
113
  TranslatableCaption.of("permission.no_permission_event"),
113
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
114
+ TagResolver.resolver(
115
+ "node",
116
+ Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)
117
+ )
114
118
  );
115
119
  entity.remove();
116
120
  event.setCancelled(true);
@@ -119,7 +123,10 @@ public class ProjectileEventListener implements Listener {
119
123
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
120
124
  pp.sendMessage(
121
125
  TranslatableCaption.of("permission.no_permission_event"),
122
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
126
+ TagResolver.resolver(
127
+ "node",
128
+ Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)
129
+ )
123
130
  );
124
131
  entity.remove();
125
132
  event.setCancelled(true);
@@ -129,7 +136,10 @@ public class ProjectileEventListener implements Listener {
129
136
  if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
130
137
  pp.sendMessage(
131
138
  TranslatableCaption.of("permission.no_permission_event"),
132
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
139
+ TagResolver.resolver(
140
+ "node",
141
+ Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)
142
+ )
133
143
  );
134
144
  entity.remove();
135
145
  event.setCancelled(true);
Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java CHANGED
@@ -71,31 +71,11 @@ public class BukkitPlayer extends PlotPlayer<Player> {
71
71
  * @param eventDispatcher EventDispatcher instance
72
72
  * @param player Bukkit player instance
73
73
  * @param permissionHandler PermissionHandler instance
74
- *
75
- * @deprecated Please do not use this method. Instead use {@link BukkitUtil#adapt(Player)}, as it caches player objects.
76
- * This method will be made private in a future release.
77
- */
78
- @Deprecated(forRemoval = true, since = "6.10.9")
79
- public BukkitPlayer(
80
- final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher,
81
- final @NonNull Player player, final @NonNull PermissionHandler permissionHandler
82
- ) {
83
- this(plotAreaManager, eventDispatcher, player, false, permissionHandler);
84
- }
85
-
86
- /**
87
- * @param plotAreaManager PlotAreaManager instance
88
- * @param eventDispatcher EventDispatcher instance
89
- * @param player Bukkit player instance
90
- * @param permissionHandler PermissionHandler instance
91
- *
92
- * @deprecated Please do not use this method. Instead use {@link BukkitUtil#adapt(Player)}, as it caches player objects.
93
- * This method will be made private in a future release.
94
74
  */
95
- @Deprecated(forRemoval = true, since = "6.10.9")
96
- public BukkitPlayer(
97
- final @NonNull PlotAreaManager plotAreaManager, final @NonNull
98
- EventDispatcher eventDispatcher, final @NonNull Player player,
75
+ BukkitPlayer(
76
+ final @NonNull PlotAreaManager plotAreaManager,
77
+ final @NonNull EventDispatcher eventDispatcher,
78
+ final @NonNull Player player,
99
79
  final boolean realPlayer,
100
80
  final @NonNull PermissionHandler permissionHandler
101
81
  ) {
Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayerManager.java CHANGED
@@ -54,7 +54,6 @@ public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
54
54
 
55
55
  @NonNull
56
56
  @Override
57
- @SuppressWarnings("deprecation")
58
57
  public BukkitPlayer getPlayer(final @NonNull Player object) {
59
58
  if (object.getUniqueId().version() == 2) { // not a real player
60
59
  return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, object, false, this.permissionHandler);
@@ -66,13 +65,12 @@ public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
66
65
  }
67
66
 
68
67
  @Override
69
- @SuppressWarnings("deprecation")
70
68
  public @NonNull BukkitPlayer createPlayer(final @NonNull UUID uuid) {
71
69
  final Player player = Bukkit.getPlayer(uuid);
72
70
  if (player == null || !player.isOnline()) {
73
71
  throw new NoSuchPlayerException(uuid);
74
72
  }
75
- return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, player, this.permissionHandler);
73
+ return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, player, false, this.permissionHandler);
76
74
  }
77
75
 
78
76
  @Nullable
Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java CHANGED
@@ -24,7 +24,7 @@ import com.plotsquared.bukkit.util.BukkitBlockUtil;
24
24
  import com.plotsquared.bukkit.util.BukkitUtil;
25
25
  import com.plotsquared.core.location.ChunkWrapper;
26
26
  import com.plotsquared.core.location.Location;
27
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
27
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
28
28
  import com.plotsquared.core.util.ChunkUtil;
29
29
  import com.plotsquared.core.util.PatternUtil;
30
30
  import com.sk89q.worldedit.bukkit.BukkitAdapter;
@@ -44,8 +44,11 @@ import org.checkerframework.checker.nullness.qual.Nullable;
44
44
 
45
45
  import java.util.Arrays;
46
46
 
47
+ /**
48
+ * Internal use only. Subject to changes at any time.
49
+ */
47
50
  @DoNotUse
48
- public class GenChunk extends ScopedQueueCoordinator {
51
+ public class GenChunk extends ZeroedDelegateScopedQueueCoordinator {
49
52
 
50
53
  public final Biome[] biomes;
51
54
  public BlockState[][] result;
Bukkit/src/main/java/com/plotsquared/bukkit/schematic/StateWrapper.java CHANGED
@@ -37,7 +37,6 @@ import org.bukkit.block.Sign;
37
37
  import org.bukkit.block.Skull;
38
38
  import org.bukkit.enchantments.Enchantment;
39
39
  import org.bukkit.inventory.Inventory;
40
- import org.bukkit.inventory.InventoryHolder;
41
40
  import org.bukkit.inventory.ItemStack;
42
41
  import org.checkerframework.checker.nullness.qual.NonNull;
43
42
 
@@ -52,15 +51,6 @@ public class StateWrapper {
52
51
  public org.bukkit.block.BlockState state = null;
53
52
  public CompoundTag tag = null;
54
53
 
55
- /**
56
- * @deprecated in favour of using WE methods for obtaining NBT, specifically by obtaining a
57
- * {@link com.sk89q.worldedit.world.block.BaseBlock} and then using {@link com.sk89q.worldedit.world.block.BaseBlock#getNbtData()}
58
- */
59
- @Deprecated(forRemoval = true, since = "6.9.0")
60
- public StateWrapper(org.bukkit.block.BlockState state) {
61
- this.state = state;
62
- }
63
-
64
54
  public StateWrapper(CompoundTag tag) {
65
55
  this.tag = tag;
66
56
  }
@@ -254,26 +244,6 @@ public class StateWrapper {
254
244
  return false;
255
245
  }
256
246
 
257
- /**
258
- * Get a CompoundTag of the contents of a block's inventory (chest, furnace, etc.).
259
- *
260
- * @deprecated in favour of using WorldEdit methods for obtaining NBT, specifically by obtaining a
261
- * {@link com.sk89q.worldedit.world.block.BaseBlock} and then using {@link com.sk89q.worldedit.world.block.BaseBlock#getNbtData()}
262
- */
263
- @Deprecated(forRemoval = true, since = "6.9.0")
264
- public CompoundTag getTag() {
265
- if (this.tag != null) {
266
- return this.tag;
267
- }
268
- if (this.state instanceof InventoryHolder inv) {
269
- ItemStack[] contents = inv.getInventory().getContents();
270
- Map<String, Tag> values = new HashMap<>();
271
- values.put("Items", new ListTag(CompoundTag.class, serializeInventory(contents)));
272
- return new CompoundTag(values);
273
- }
274
- return null;
275
- }
276
-
277
247
  public String getId() {
278
248
  String tileid = this.tag.getString("id").toLowerCase();
279
249
  if (tileid.startsWith("minecraft:")) {
Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java CHANGED
@@ -42,7 +42,9 @@ import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
42
42
  import com.plotsquared.core.util.EntityUtil;
43
43
  import com.plotsquared.core.util.entity.EntityCategories;
44
44
  import com.sk89q.worldedit.bukkit.BukkitAdapter;
45
- import net.kyori.adventure.text.minimessage.Template;
45
+ import net.kyori.adventure.text.Component;
46
+ import net.kyori.adventure.text.minimessage.tag.Tag;
47
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
46
48
  import org.bukkit.entity.Arrow;
47
49
  import org.bukkit.entity.Creature;
48
50
  import org.bukkit.entity.Entity;
@@ -179,7 +181,10 @@ public class BukkitEntityUtil {
179
181
  if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
180
182
  plotPlayer.sendMessage(
181
183
  TranslatableCaption.of("permission.no_permission_event"),
182
- Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
184
+ TagResolver.resolver(
185
+ "node",
186
+ Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_DESTROY + "." + stub))
187
+ )
183
188
  );
184
189
  return false;
185
190
  }
@@ -191,7 +196,10 @@ public class BukkitEntityUtil {
191
196
  if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
192
197
  plotPlayer.sendMessage(
193
198
  TranslatableCaption.of("permission.no_permission_event"),
194
- Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
199
+ TagResolver.resolver(
200
+ "node",
201
+ Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_DESTROY + "." + stub))
202
+ )
195
203
  );
196
204
  if (plot != null) {
197
205
  plot.debug(player.getName()
@@ -212,7 +220,10 @@ public class BukkitEntityUtil {
212
220
  if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
213
221
  plotPlayer.sendMessage(
214
222
  TranslatableCaption.of("permission.no_permission_event"),
215
- Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
223
+ TagResolver.resolver(
224
+ "node",
225
+ Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
226
+ )
216
227
  );
217
228
  if (plot != null) {
218
229
  plot.debug(player.getName() + " could not attack " + entityType
@@ -233,7 +244,10 @@ public class BukkitEntityUtil {
233
244
  if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
234
245
  plotPlayer.sendMessage(
235
246
  TranslatableCaption.of("permission.no_permission_event"),
236
- Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
247
+ TagResolver.resolver(
248
+ "node",
249
+ Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
250
+ )
237
251
  );
238
252
  if (plot != null) {
239
253
  plot.debug(player.getName() + " could not attack " + entityType
@@ -246,7 +260,10 @@ public class BukkitEntityUtil {
246
260
  if (!plot.getFlag(PvpFlag.class) && !plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
247
261
  plotPlayer.sendMessage(
248
262
  TranslatableCaption.of("permission.no_permission_event"),
249
- Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
263
+ TagResolver.resolver(
264
+ "node",
265
+ Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVP + "." + stub))
266
+ )
250
267
  );
251
268
  plot.debug(player.getName() + " could not attack " + entityType
252
269
  + " because pve = false");
@@ -260,7 +277,10 @@ public class BukkitEntityUtil {
260
277
  if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
261
278
  plotPlayer.sendMessage(
262
279
  TranslatableCaption.of("permission.no_permission_event"),
263
- Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
280
+ TagResolver.resolver(
281
+ "node",
282
+ Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVP + "." + stub))
283
+ )
264
284
  );
265
285
  return false;
266
286
  }
@@ -277,7 +297,10 @@ public class BukkitEntityUtil {
277
297
  if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
278
298
  plotPlayer.sendMessage(
279
299
  TranslatableCaption.of("permission.no_permission_event"),
280
- Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
300
+ TagResolver.resolver(
301
+ "node",
302
+ Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
303
+ )
281
304
  );
282
305
  if (plot != null) {
283
306
  plot.debug(player.getName() + " could not attack " + entityType
@@ -299,7 +322,10 @@ public class BukkitEntityUtil {
299
322
  if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
300
323
  plotPlayer.sendMessage(
301
324
  TranslatableCaption.of("permission.no_permission_event"),
302
- Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
325
+ TagResolver.resolver(
326
+ "node",
327
+ Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
328
+ )
303
329
  );
304
330
  if (plot != null) {
305
331
  plot.debug(player.getName() + " could not attack " + entityType
Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitInventoryUtil.java CHANGED
@@ -56,7 +56,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
56
56
  ItemMeta meta = null;
57
57
  if (item.getName() != null) {
58
58
  meta = stack.getItemMeta();
59
- Component nameComponent = BukkitUtil.MINI_MESSAGE.parse(item.getName());
59
+ Component nameComponent = BukkitUtil.MINI_MESSAGE.deserialize(item.getName());
60
60
  meta.setDisplayName(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(nameComponent));
61
61
  }
62
62
  if (item.getLore() != null) {
Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java CHANGED
@@ -30,7 +30,7 @@ import com.plotsquared.core.plot.PlotArea;
30
30
  import com.plotsquared.core.plot.PlotManager;
31
31
  import com.plotsquared.core.queue.GlobalBlockQueue;
32
32
  import com.plotsquared.core.queue.QueueCoordinator;
33
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
33
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
34
34
  import com.plotsquared.core.util.ChunkManager;
35
35
  import com.plotsquared.core.util.RegionManager;
36
36
  import com.plotsquared.core.util.WorldUtil;
@@ -257,9 +257,9 @@ public class BukkitRegionManager extends RegionManager {
257
257
  map.saveEntitiesOut(Bukkit.getWorld(world.getName()).getChunkAt(x, z), currentPlotClear);
258
258
  AugmentedUtils.bypass(
259
259
  ignoreAugment,
260
- () -> ChunkManager.setChunkInPlotArea(null, new RunnableVal<ScopedQueueCoordinator>() {
260
+ () -> ChunkManager.setChunkInPlotArea(null, new RunnableVal<ZeroedDelegateScopedQueueCoordinator>() {
261
261
  @Override
262
- public void run(ScopedQueueCoordinator value) {
262
+ public void run(ZeroedDelegateScopedQueueCoordinator value) {
263
263
  Location min = value.getMin();
264
264
  int bx = min.getX();
265
265
  int bz = min.getZ();
Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java CHANGED
@@ -45,7 +45,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
45
45
  import io.papermc.lib.PaperLib;
46
46
  import net.kyori.adventure.platform.bukkit.BukkitAudiences;
47
47
  import net.kyori.adventure.text.minimessage.MiniMessage;
48
- import net.kyori.adventure.text.minimessage.Template;
48
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
49
49
  import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
50
50
  import org.apache.logging.log4j.LogManager;
51
51
  import org.apache.logging.log4j.Logger;
@@ -333,7 +333,7 @@ public class BukkitUtil extends WorldUtil {
333
333
  @SuppressWarnings("deprecation")
334
334
  public void setSign(
335
335
  final @NonNull Location location, final @NonNull Caption[] lines,
336
- final @NonNull Template... replacements
336
+ final @NonNull TagResolver... replacements
337
337
  ) {
338
338
  ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> {
339
339
  PlotArea area = location.getPlotArea();
@@ -366,8 +366,9 @@ public class BukkitUtil extends WorldUtil {
366
366
  final org.bukkit.block.BlockState blockstate = block.getState();
367
367
  if (blockstate instanceof final Sign sign) {
368
368
  for (int i = 0; i < lines.length; i++) {
369
- sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
370
- .serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()), replacements)));
369
+ sign.setLine(i, LEGACY_COMPONENT_SERIALIZER.serialize(
370
+ MINI_MESSAGE.deserialize(lines[i].getComponent(LocaleHolder.console()), replacements)
371
+ ));
371
372
  }
372
373
  sign.update(true, false);
373
374
  }
Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitWorld.java CHANGED
@@ -132,14 +132,6 @@ public class BukkitWorld implements World<org.bukkit.World> {
132
132
  return world.hashCode();
133
133
  }
134
134
 
135
- /**
136
- * @deprecated This method is not meant to be invoked or overridden, with no replacement.
137
- */
138
- @Deprecated(forRemoval = true, since = "6.6.0")
139
- protected boolean canEqual(final Object other) {
140
- return other instanceof BukkitWorld;
141
- }
142
-
143
135
  public String toString() {
144
136
  return "BukkitWorld(world=" + this.world + ")";
145
137
  }
Bukkit/src/main/java/com/plotsquared/bukkit/util/TranslationUpdateManager.java ADDED
@@ -0,0 +1,63 @@
1
+ /*
2
+ * PlotSquared, a land and world management plugin for Minecraft.
3
+ * Copyright (C) IntellectualSites <https://intellectualsites.com>
4
+ * Copyright (C) IntellectualSites team and contributors
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
+ */
19
+ package com.plotsquared.bukkit.util;
20
+
21
+ import com.intellectualsites.annotations.NotPublic;
22
+ import com.plotsquared.core.PlotSquared;
23
+
24
+ import java.io.IOException;
25
+ import java.nio.file.Files;
26
+ import java.nio.file.Path;
27
+ import java.nio.file.Paths;
28
+ import java.util.stream.Stream;
29
+
30
+ /**
31
+ * This is a helper class which replaces occurrences of 'suggest_command' with 'run_command' in messages_%.json.
32
+ * MiniMessage changed the syntax between major releases. To warrant a smooth upgrade, we attempt to replace any occurrences
33
+ * while loading PlotSquared.
34
+ *
35
+ * @since TODO
36
+ */
37
+ @NotPublic
38
+ public class TranslationUpdateManager {
39
+
40
+ public static void upgradeTranslationFile() throws IOException {
41
+ String searchText = "suggest_command";
42
+ String replacementText = "run_command";
43
+
44
+ try (Stream<Path> paths = Files.walk(Paths.get(PlotSquared.platform().getDirectory().toPath().resolve("lang").toUri()))) {
45
+ paths
46
+ .filter(Files::isRegularFile)
47
+ .filter(p -> p.getFileName().toString().matches("messages_[a-z]{2}\\.json"))
48
+ .forEach(p -> replaceInFile(p, searchText, replacementText));
49
+ }
50
+ }
51
+
52
+ private static void replaceInFile(Path path, String searchText, String replacementText) {
53
+ try {
54
+ String content = Files.readString(path);
55
+ if (content.contains(searchText)) {
56
+ content = content.replaceAll(searchText, replacementText);
57
+ Files.writeString(path, content);
58
+ }
59
+ } catch (IOException e) {
60
+ e.printStackTrace();
61
+ }
62
+ }
63
+ }
Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweRegionManager.java CHANGED
@@ -94,11 +94,6 @@ public class FaweRegionManager extends BukkitRegionManager {
94
94
  delegate.swap(pos1, pos2, swapPos, whenDone);
95
95
  }
96
96
 
97
- @Override
98
- public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, String world, Runnable whenDone) {
99
- delegate.setBiome(region, extendBiome, biome, world, whenDone);
100
- }
101
-
102
97
  @Override
103
98
  public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, PlotArea area, Runnable whenDone) {
104
99
  delegate.setBiome(region, extendBiome, biome, area.getWorldName(), whenDone);
Core/build.gradle.kts CHANGED
@@ -68,7 +68,8 @@ tasks {
68
68
  val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString()
69
69
  val opt = options as StandardJavadocDocletOptions
70
70
  opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/" + libs.worldeditCore.get().versionConstraint.toString())
71
- opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
71
+ opt.links("https://jd.adventure.kyori.net/api/4.12.0/")
72
+ opt.links("https://jd.adventure.kyori.net/text-minimessage/4.12.0/")
72
73
  opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
73
74
  opt.links("https://checkerframework.org/api/")
74
75
  opt.links("https://javadoc.io/doc/com.intellectualsites.informative-annotations/informative-annotations/latest/")
Core/src/main/java/com/plotsquared/core/PlotAPI.java CHANGED
@@ -30,7 +30,7 @@ import com.plotsquared.core.util.ChunkManager;
30
30
  import com.plotsquared.core.util.EventDispatcher;
31
31
  import com.plotsquared.core.util.SchematicHandler;
32
32
  import com.plotsquared.core.util.query.PlotQuery;
33
- import net.kyori.adventure.text.minimessage.Template;
33
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
34
34
  import org.checkerframework.checker.nullness.qual.NonNull;
35
35
  import org.checkerframework.checker.nullness.qual.Nullable;
36
36
 
@@ -145,7 +145,7 @@ public class PlotAPI {
145
145
  */
146
146
  public void sendConsoleMessage(
147
147
  final @NonNull String message,
148
- final @NonNull Template @NonNull ... replacements
148
+ final @NonNull TagResolver @NonNull ... replacements
149
149
  ) {
150
150
  ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements);
151
151
  }
@@ -158,7 +158,7 @@ public class PlotAPI {
158
158
  */
159
159
  public void sendConsoleMessage(
160
160
  final @NonNull Caption caption,
161
- final @NonNull Template @NonNull ... replacements
161
+ final @NonNull TagResolver @NonNull ... replacements
162
162
  ) {
163
163
  ConsolePlayer.getConsole().sendMessage(caption, replacements);
164
164
  }
Core/src/main/java/com/plotsquared/core/PlotSquared.java CHANGED
@@ -790,7 +790,9 @@ public class PlotSquared {
790
790
  if (world.equals("CheckingPlotSquaredGenerator")) {
791
791
  return;
792
792
  }
793
- this.getPlotAreaManager().addWorld(world);
793
+ if (!this.getPlotAreaManager().addWorld(world)) {
794
+ return;
795
+ }
794
796
  Set<String> worlds;
795
797
  if (this.worldConfiguration.contains("worlds")) {
796
798
  worlds = this.worldConfiguration.getConfigurationSection("worlds").getKeys(false);
Core/src/main/java/com/plotsquared/core/backup/PlayerBackupProfile.java CHANGED
@@ -200,7 +200,7 @@ public class PlayerBackupProfile implements BackupProfile {
200
200
  if (value) {
201
201
  future.complete(null);
202
202
  } else {
203
- future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens(
203
+ future.completeExceptionally(new RuntimeException(MINI_MESSAGE.escapeTags(
204
204
  TranslatableCaption
205
205
  .of("schematics.schematic_paste_failed")
206
206
  .getComponent(ConsolePlayer.getConsole()))));
Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java CHANGED
@@ -24,13 +24,14 @@ import com.google.inject.Inject;
24
24
  import com.google.inject.Singleton;
25
25
  import com.plotsquared.core.PlotSquared;
26
26
  import com.plotsquared.core.configuration.Settings;
27
- import com.plotsquared.core.configuration.caption.Templates;
28
27
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
29
28
  import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
30
29
  import com.plotsquared.core.player.PlotPlayer;
31
30
  import com.plotsquared.core.plot.Plot;
32
31
  import com.plotsquared.core.util.task.TaskManager;
33
- import net.kyori.adventure.text.minimessage.Template;
32
+ import net.kyori.adventure.text.Component;
33
+ import net.kyori.adventure.text.minimessage.tag.Tag;
34
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
34
35
  import org.checkerframework.checker.nullness.qual.NonNull;
35
36
  import org.checkerframework.checker.nullness.qual.Nullable;
36
37
 
@@ -100,7 +101,7 @@ public class SimpleBackupManager implements BackupManager {
100
101
  if (player != null) {
101
102
  player.sendMessage(
102
103
  TranslatableCaption.of("backups.backup_automatic_started"),
103
- Template.of("plot", plot.getId().toString())
104
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
104
105
  );
105
106
  }
106
107
  profile.createBackup().whenComplete((backup, throwable) -> {
@@ -108,7 +109,7 @@ public class SimpleBackupManager implements BackupManager {
108
109
  if (player != null) {
109
110
  player.sendMessage(
110
111
  TranslatableCaption.of("backups.backup_automatic_failure"),
111
- Templates.of("reason", throwable.getMessage())
112
+ TagResolver.resolver("reason", Tag.inserting(Component.text(throwable.getMessage())))
112
113
  );
113
114
  }
114
115
  throwable.printStackTrace();
Core/src/main/java/com/plotsquared/core/command/Add.java CHANGED
@@ -30,7 +30,9 @@ import com.plotsquared.core.util.PlayerManager;
30
30
  import com.plotsquared.core.util.TabCompletions;
31
31
  import com.plotsquared.core.util.task.RunnableVal2;
32
32
  import com.plotsquared.core.util.task.RunnableVal3;
33
- import net.kyori.adventure.text.minimessage.Template;
33
+ import net.kyori.adventure.text.Component;
34
+ import net.kyori.adventure.text.minimessage.tag.Tag;
35
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
34
36
  import org.checkerframework.checker.nullness.qual.NonNull;
35
37
 
36
38
  import java.util.Collection;
@@ -68,10 +70,9 @@ public class Add extends Command {
68
70
  plot.isOwner(player.getUUID()) || player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_TRUST),
69
71
  TranslatableCaption.of("permission.no_plot_perms")
70
72
  );
71
- checkTrue(
72
- args.length == 1,
73
+ checkTrue(args.length == 1,
73
74
  TranslatableCaption.of("commandconfig.command_syntax"),
74
- Template.of("value", "/plot add <player | *>")
75
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot add <player | *>")))
75
76
  );
76
77
  final CompletableFuture<Boolean> future = new CompletableFuture<>();
77
78
  PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
@@ -81,7 +82,7 @@ public class Add extends Command {
81
82
  } else {
82
83
  player.sendMessage(
83
84
  TranslatableCaption.of("errors.invalid_player"),
84
- Template.of("value", args[0])
85
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
85
86
  );
86
87
  }
87
88
  future.completeExceptionally(throwable);
@@ -89,7 +90,7 @@ public class Add extends Command {
89
90
  } else {
90
91
  try {
91
92
  checkTrue(!uuids.isEmpty(), TranslatableCaption.of("errors.invalid_player"),
92
- Template.of("value", args[0])
93
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
93
94
  );
94
95
  Iterator<UUID> iterator = uuids.iterator();
95
96
  int size = plot.getTrusted().size() + plot.getMembers().size();
@@ -99,7 +100,9 @@ public class Add extends Command {
99
100
  Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
100
101
  player.sendMessage(
101
102
  TranslatableCaption.of("errors.invalid_player"),
102
- Template.of("value", PlayerManager.resolveName(uuid).getComponent(player))
103
+ TagResolver.resolver("value", Tag.inserting(
104
+ PlayerManager.resolveName(uuid).toComponent(player)
105
+ ))
103
106
  );
104
107
  iterator.remove();
105
108
  continue;
@@ -107,7 +110,9 @@ public class Add extends Command {
107
110
  if (plot.isOwner(uuid)) {
108
111
  player.sendMessage(
109
112
  TranslatableCaption.of("member.already_added"),
110
- Template.of("player", PlayerManager.resolveName(uuid).getComponent(player))
113
+ TagResolver.resolver("player", Tag.inserting(
114
+ PlayerManager.resolveName(uuid).toComponent(player)
115
+ ))
111
116
  );
112
117
  iterator.remove();
113
118
  continue;
@@ -115,7 +120,9 @@ public class Add extends Command {
115
120
  if (plot.getMembers().contains(uuid)) {
116
121
  player.sendMessage(
117
122
  TranslatableCaption.of("member.already_added"),
118
- Template.of("player", PlayerManager.resolveName(uuid).getComponent(player))
123
+ TagResolver.resolver("player", Tag.inserting(
124
+ PlayerManager.resolveName(uuid).toComponent(player)
125
+ ))
119
126
  );
120
127
  iterator.remove();
121
128
  continue;
@@ -128,7 +135,7 @@ public class Add extends Command {
128
135
  if (localAddSize >= maxAddSize) {
129
136
  player.sendMessage(
130
137
  TranslatableCaption.of("members.plot_max_members_added"),
131
- Template.of("amount", String.valueOf(localAddSize))
138
+ TagResolver.resolver("amount", Tag.inserting(Component.text(localAddSize)))
132
139
  );
133
140
  return;
134
141
  }
Core/src/main/java/com/plotsquared/core/command/Alias.java CHANGED
@@ -27,7 +27,9 @@ import com.plotsquared.core.player.PlotPlayer;
27
27
  import com.plotsquared.core.plot.Plot;
28
28
  import com.plotsquared.core.util.MathMan;
29
29
  import com.plotsquared.core.util.query.PlotQuery;
30
- import net.kyori.adventure.text.minimessage.Template;
30
+ import net.kyori.adventure.text.Component;
31
+ import net.kyori.adventure.text.minimessage.tag.Tag;
32
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
31
33
 
32
34
  import java.util.ArrayList;
33
35
  import java.util.Collection;
@@ -91,7 +93,10 @@ public class Alias extends SubCommand {
91
93
  } else {
92
94
  player.sendMessage(
93
95
  TranslatableCaption.of("permission.no_permission"),
94
- Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_SET))
96
+ TagResolver.resolver(
97
+ "node",
98
+ Tag.inserting(Permission.PERMISSION_ALIAS_SET)
99
+ )
95
100
  );
96
101
  }
97
102
  }
@@ -107,7 +112,10 @@ public class Alias extends SubCommand {
107
112
  } else {
108
113
  player.sendMessage(
109
114
  TranslatableCaption.of("permission.no_permission"),
110
- Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE))
115
+ TagResolver.resolver(
116
+ "node",
117
+ Tag.inserting(Permission.PERMISSION_ALIAS_REMOVE)
118
+ )
111
119
  );
112
120
  }
113
121
  }
@@ -148,13 +156,16 @@ public class Alias extends SubCommand {
148
156
  .anyMatch()) {
149
157
  player.sendMessage(
150
158
  TranslatableCaption.of("alias.alias_is_taken"),
151
- Template.of("alias", alias)
159
+ TagResolver.resolver("alias", Tag.inserting(Component.text(alias)))
152
160
  );
153
161
  return;
154
162
  }
155
163
  if (Settings.UUID.OFFLINE) {
156
164
  plot.setAlias(alias);
157
- player.sendMessage(TranslatableCaption.of("alias.alias_set_to"), Template.of("alias", alias));
165
+ player.sendMessage(
166
+ TranslatableCaption.of("alias.alias_set_to"),
167
+ TagResolver.resolver("alias", Tag.inserting(Component.text(alias)))
168
+ );
158
169
  return;
159
170
  }
160
171
  PlotSquared.get().getImpromptuUUIDPipeline().getSingle(alias, ((uuid, throwable) -> {
@@ -163,13 +174,13 @@ public class Alias extends SubCommand {
163
174
  } else if (uuid != null) {
164
175
  player.sendMessage(
165
176
  TranslatableCaption.of("alias.alias_is_taken"),
166
- Template.of("alias", alias)
177
+ TagResolver.resolver("alias", Tag.inserting(Component.text(alias)))
167
178
  );
168
179
  } else {
169
180
  plot.setAlias(alias);
170
181
  player.sendMessage(
171
182
  TranslatableCaption.of("alias.alias_set_to"),
172
- Template.of("alias", alias)
183
+ TagResolver.resolver("alias", Tag.inserting(Component.text(alias)))
173
184
  );
174
185
  }
175
186
  }));
@@ -181,7 +192,7 @@ public class Alias extends SubCommand {
181
192
  if (!plot.getAlias().isEmpty()) {
182
193
  player.sendMessage(
183
194
  TranslatableCaption.of("alias.alias_removed"),
184
- Template.of("alias", alias)
195
+ TagResolver.resolver("alias", Tag.inserting(Component.text(alias)))
185
196
  );
186
197
  } else {
187
198
  player.sendMessage(
Core/src/main/java/com/plotsquared/core/command/Area.java CHANGED
@@ -24,7 +24,6 @@ import com.plotsquared.core.configuration.ConfigurationSection;
24
24
  import com.plotsquared.core.configuration.ConfigurationUtil;
25
25
  import com.plotsquared.core.configuration.Settings;
26
26
  import com.plotsquared.core.configuration.caption.CaptionHolder;
27
- import com.plotsquared.core.configuration.caption.Templates;
28
27
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
29
28
  import com.plotsquared.core.configuration.file.YamlConfiguration;
30
29
  import com.plotsquared.core.events.TeleportCause;
@@ -69,7 +68,9 @@ import com.sk89q.worldedit.math.BlockVector3;
69
68
  import com.sk89q.worldedit.regions.CuboidRegion;
70
69
  import com.sk89q.worldedit.regions.Region;
71
70
  import com.sk89q.worldedit.world.World;
72
- import net.kyori.adventure.text.minimessage.Template;
71
+ import net.kyori.adventure.text.Component;
72
+ import net.kyori.adventure.text.minimessage.tag.Tag;
73
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
73
74
  import org.checkerframework.checker.nullness.qual.NonNull;
74
75
 
75
76
  import java.io.File;
@@ -141,14 +142,17 @@ public class Area extends SubCommand {
141
142
  if (!player.hasPermission(Permission.PERMISSION_AREA_CREATE)) {
142
143
  player.sendMessage(
143
144
  TranslatableCaption.of("permission.no_permission"),
144
- Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
145
+ TagResolver.resolver(
146
+ "node",
147
+ Tag.inserting(Permission.PERMISSION_AREA_CREATE)
148
+ )
145
149
  );
146
150
  return false;
147
151
  }
148
152
  if (args.length < 2) {
149
153
  player.sendMessage(
150
154
  TranslatableCaption.of("single.single_area_needs_name"),
151
- Template.of("command", "/plot area single <name>")
155
+ TagResolver.resolver("command", Tag.inserting(Component.text("/plot area single <name>")))
152
156
  );
153
157
  return false;
154
158
  }
@@ -279,7 +283,7 @@ public class Area extends SubCommand {
279
283
  } else {
280
284
  player.sendMessage(
281
285
  TranslatableCaption.of("errors.error_create"),
282
- Template.of("world", hybridPlotWorld.getWorldName())
286
+ TagResolver.resolver("world", Tag.inserting(Component.text(hybridPlotWorld.getWorldName())))
283
287
  );
284
288
  }
285
289
  };
@@ -290,7 +294,10 @@ public class Area extends SubCommand {
290
294
  if (!player.hasPermission(Permission.PERMISSION_AREA_CREATE)) {
291
295
  player.sendMessage(
292
296
  TranslatableCaption.of("permission.no_permission"),
293
- Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
297
+ TagResolver.resolver(
298
+ "node",
299
+ Tag.inserting(Permission.PERMISSION_AREA_CREATE)
300
+ )
294
301
  );
295
302
  return false;
296
303
  }
@@ -298,7 +305,10 @@ public class Area extends SubCommand {
298
305
  case 1:
299
306
  player.sendMessage(
300
307
  TranslatableCaption.of("commandconfig.command_syntax"),
301
- Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
308
+ TagResolver.resolver(
309
+ "value",
310
+ Tag.inserting(Component.text("/plot area create [world[:id]] [<modifier>=<value>]..."))
311
+ )
302
312
  );
303
313
  return false;
304
314
  case 2:
@@ -312,7 +322,11 @@ public class Area extends SubCommand {
312
322
  if (area == null) {
313
323
  player.sendMessage(
314
324
  TranslatableCaption.of("commandconfig.command_syntax"),
315
- Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
325
+ TagResolver.resolver(
326
+ "value",
327
+ Tag.inserting(Component.text(
328
+ "/plot area create [world[:id]] [<modifier>=<value>]..."))
329
+ )
316
330
  );
317
331
  return false;
318
332
  }
@@ -323,12 +337,18 @@ public class Area extends SubCommand {
323
337
  );
324
338
  player.sendMessage(
325
339
  TranslatableCaption.of("set.set_attribute"),
326
- Template.of("attribute", "area_pos1"),
327
- Template.of("value", location.getX() + "," + location.getZ())
340
+ TagResolver.builder()
341
+ .tag("attribute", Tag.inserting(Component.text("area_pos1")))
342
+ .tag("value", Tag.inserting(
343
+ Component.text(location.getX())
344
+ .append(Component.text(","))
345
+ .append(Component.text(location.getZ()))
346
+ ))
347
+ .build()
328
348
  );
329
349
  player.sendMessage(
330
350
  TranslatableCaption.of("area.set_pos2"),
331
- Template.of("command", "/plot area create pos2")
351
+ TagResolver.resolver("command", Tag.inserting(Component.text("/plot area create pos2")))
332
352
  );
333
353
  return true;
334
354
  }
@@ -342,7 +362,11 @@ public class Area extends SubCommand {
342
362
  if (area == null) {
343
363
  player.sendMessage(
344
364
  TranslatableCaption.of("commandconfig.command_syntax"),
345
- Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
365
+ TagResolver.resolver(
366
+ "value",
367
+ Tag.inserting(Component.text(
368
+ "/plot area create [world[:id]] [<modifier>=<value>]..."))
369
+ )
346
370
  );
347
371
  return false;
348
372
  }
@@ -369,7 +393,10 @@ public class Area extends SubCommand {
369
393
  if (!areas.isEmpty()) {
370
394
  player.sendMessage(
371
395
  TranslatableCaption.of("cluster.cluster_intersection"),
372
- Template.of("cluster", areas.iterator().next().toString())
396
+ TagResolver.resolver(
397
+ "cluster",
398
+ Tag.inserting(areas.iterator().next())
399
+ )
373
400
  );
374
401
  return false;
375
402
  }
@@ -395,8 +422,7 @@ public class Area extends SubCommand {
395
422
  player.sendMessage(TranslatableCaption.of("setup.setup_finished"));
396
423
  if (area.getTerrain() != PlotAreaTerrainType.ALL) {
397
424
  QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world));
398
- queue.setChunkConsumer(chunk -> AugmentedUtils.generate(
399
- null,
425
+ queue.setChunkConsumer(chunk -> AugmentedUtils.generateChunk(
400
426
  world,
401
427
  chunk.getX(),
402
428
  chunk.getZ(),
@@ -408,7 +434,7 @@ public class Area extends SubCommand {
408
434
  } else {
409
435
  player.sendMessage(
410
436
  TranslatableCaption.of("errors.error_create"),
411
- Template.of("world", area.getWorldName())
437
+ TagResolver.resolver("world", Tag.inserting(Component.text(area.getWorldName())))
412
438
  );
413
439
  }
414
440
  };
@@ -442,7 +468,7 @@ public class Area extends SubCommand {
442
468
  if (other != null && Objects.equals(pa.getId(), other.getId())) {
443
469
  player.sendMessage(
444
470
  TranslatableCaption.of("setup.setup_world_taken"),
445
- Template.of("value", pa.toString())
471
+ TagResolver.resolver("value", Tag.inserting(Component.text(pa.getId())))
446
472
  );
447
473
  return false;
448
474
  }
@@ -457,8 +483,13 @@ public class Area extends SubCommand {
457
483
  if (pair.length != 2) {
458
484
  player.sendMessage(
459
485
  TranslatableCaption.of("commandconfig.command_syntax_extended"),
460
- Template.of("value1,", getCommandString()),
461
- Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
486
+ TagResolver.builder()
487
+ .tag("value1", Tag.inserting(Component.text(getCommandString())))
488
+ .tag(
489
+ "value2",
490
+ Tag.inserting(Component.text("create [world[:id]] [<modifier>=<value>]..."))
491
+ )
492
+ .build()
462
493
  );
463
494
  return false;
464
495
  }
@@ -494,8 +525,14 @@ public class Area extends SubCommand {
494
525
  default -> {
495
526
  player.sendMessage(
496
527
  TranslatableCaption.of("commandconfig.command_syntax_extended"),
497
- Template.of("value1", getCommandString()),
498
- Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
528
+ TagResolver.builder()
529
+ .tag("value1", Tag.inserting(Component.text(getCommandString())))
530
+ .tag(
531
+ "value2",
532
+ Tag.inserting(Component.text(
533
+ " create [world[:id]] [<modifier>=<value>]..."))
534
+ )
535
+ .build()
499
536
  );
500
537
  return false;
501
538
  }
@@ -505,7 +542,7 @@ public class Area extends SubCommand {
505
542
  if (this.worldUtil.isWorld(pa.getWorldName())) {
506
543
  player.sendMessage(
507
544
  TranslatableCaption.of("setup.setup_world_taken"),
508
- Template.of("value", pa.getWorldName())
545
+ TagResolver.resolver("value", Tag.inserting(Component.text(pa.getWorldName())))
509
546
  );
510
547
  return false;
511
548
  }
@@ -526,7 +563,7 @@ public class Area extends SubCommand {
526
563
  } else {
527
564
  player.sendMessage(
528
565
  TranslatableCaption.of("errors.error_create"),
529
- Template.of("world", pa.getWorldName())
566
+ TagResolver.resolver("world", Tag.inserting(Component.text(pa.getWorldName())))
530
567
  );
531
568
  }
532
569
  try {
@@ -545,12 +582,18 @@ public class Area extends SubCommand {
545
582
  if (pa.getId() == null) {
546
583
  player.sendMessage(
547
584
  TranslatableCaption.of("commandconfig.command_syntax"),
548
- Template.of("value", getUsage())
585
+ TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
549
586
  );
550
587
  player.sendMessage(
551
588
  TranslatableCaption.of("commandconfig.command_syntax_extended"),
552
- Template.of("value1", getCommandString()),
553
- Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
589
+ TagResolver.builder()
590
+ .tag("value1", Tag.inserting(Component.text(getCommandString())))
591
+ .tag(
592
+ "value2",
593
+ Tag.inserting(Component.text(
594
+ " create [world[:id]] [<modifier>=<value>]..."))
595
+ )
596
+ .build()
554
597
  );
555
598
  return false;
556
599
  }
@@ -567,7 +610,7 @@ public class Area extends SubCommand {
567
610
  metaData.computeIfAbsent(player.getUUID(), missingUUID -> new HashMap<>()).put("area_create_area", pa);
568
611
  player.sendMessage(
569
612
  TranslatableCaption.of("single.get_position"),
570
- Template.of("command", getCommandString())
613
+ TagResolver.resolver("command", Tag.inserting(Component.text(getCommandString())))
571
614
  );
572
615
  break;
573
616
  }
@@ -577,7 +620,10 @@ public class Area extends SubCommand {
577
620
  if (!player.hasPermission(Permission.PERMISSION_AREA_INFO)) {
578
621
  player.sendMessage(
579
622
  TranslatableCaption.of("permission.no_permission"),
580
- Template.of("node", String.valueOf(Permission.PERMISSION_AREA_INFO))
623
+ TagResolver.resolver(
624
+ "node",
625
+ Tag.inserting(Permission.PERMISSION_AREA_INFO)
626
+ )
581
627
  );
582
628
  return false;
583
629
  }
@@ -588,15 +634,20 @@ public class Area extends SubCommand {
588
634
  default -> {
589
635
  player.sendMessage(
590
636
  TranslatableCaption.of("commandconfig.command_syntax_extended"),
591
- Template.of("value1", getCommandString()),
592
- Template.of("value2", " info [area]")
637
+ TagResolver.builder()
638
+ .tag("value1", Tag.inserting(Component.text(getCommandString())))
639
+ .tag("value2", Tag.inserting(Component.text(" info [area]")))
640
+ .build()
593
641
  );
594
642
  return false;
595
643
  }
596
644
  }
597
645
  if (area == null) {
598
646
  if (args.length == 2) {
599
- player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1]));
647
+ player.sendMessage(
648
+ TranslatableCaption.of("errors.not_valid_plot_world"),
649
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
650
+ );
600
651
  } else {
601
652
  player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
602
653
  }
@@ -620,42 +671,35 @@ public class Area extends SubCommand {
620
671
  percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE;
621
672
  region = "N/A";
622
673
  }
623
- Template headerTemplate = Template.of(
624
- "header",
625
- TranslatableCaption.of("info.plot_info_header").getComponent(player)
626
- );
627
- Template nameTemplate = Template.of("name", name);
628
- Template typeTemplate = Template.of("type", area.getType().name());
629
- Template terrainTemplate = Template.of("terrain", area.getTerrain().name());
630
- Template usageTemplate = Template.of("usage", String.format("%.2f", percent));
631
- Template claimedTemplate = Template.of("claimed", String.valueOf(claimed));
632
- Template clustersTemplate = Template.of("clusters", String.valueOf(clusters));
633
- Template regionTemplate = Template.of("region", region);
634
- Template generatorTemplate = Template.of("generator", generator);
635
- Template footerTemplate = Template.of(
636
- "footer",
637
- TranslatableCaption.of("info.plot_info_footer").getComponent(player)
638
- );
639
- player.sendMessage(
640
- TranslatableCaption.of("info.area_info_format"),
641
- headerTemplate,
642
- nameTemplate,
643
- typeTemplate,
644
- terrainTemplate,
645
- usageTemplate,
646
- claimedTemplate,
647
- clustersTemplate,
648
- regionTemplate,
649
- generatorTemplate,
650
- footerTemplate
651
- );
674
+ TagResolver resolver = TagResolver.builder()
675
+ .tag(
676
+ "header",
677
+ Tag.inserting(TranslatableCaption.of("info.plot_info_header").toComponent(player))
678
+ )
679
+ .tag("name", Tag.inserting(Component.text(name)))
680
+ .tag("type", Tag.inserting(Component.text(area.getType().name())))
681
+ .tag("terrain", Tag.inserting(Component.text(area.getTerrain().name())))
682
+ .tag("usage", Tag.inserting(Component.text(String.format("%.2f", percent))))
683
+ .tag("claimed", Tag.inserting(Component.text(claimed)))
684
+ .tag("clusters", Tag.inserting(Component.text(clusters)))
685
+ .tag("region", Tag.inserting(Component.text(region)))
686
+ .tag("generator", Tag.inserting(Component.text(generator)))
687
+ .tag(
688
+ "footer",
689
+ Tag.inserting(TranslatableCaption.of("info.plot_info_footer").toComponent(player))
690
+ )
691
+ .build();
692
+ player.sendMessage(TranslatableCaption.of("info.area_info_format"), resolver);
652
693
  return true;
653
694
  }
654
695
  case "l", "list" -> {
655
696
  if (!player.hasPermission(Permission.PERMISSION_AREA_LIST)) {
656
697
  player.sendMessage(
657
698
  TranslatableCaption.of("permission.no_permission"),
658
- Template.of("node", String.valueOf(Permission.PERMISSION_AREA_LIST))
699
+ TagResolver.resolver(
700
+ "node",
701
+ Tag.inserting(Permission.PERMISSION_AREA_LIST)
702
+ )
659
703
  );
660
704
  return false;
661
705
  }
@@ -672,8 +716,10 @@ public class Area extends SubCommand {
672
716
  default:
673
717
  player.sendMessage(
674
718
  TranslatableCaption.of("commandconfig.command_syntax_extended"),
675
- Template.of("value1", getCommandString()),
676
- Template.of("value2", " list [#]")
719
+ TagResolver.builder()
720
+ .tag("value1", Tag.inserting(Component.text(getCommandString())))
721
+ .tag("value2", Tag.inserting(Component.text(" list [#]")))
722
+ .build()
677
723
  );
678
724
  return false;
679
725
  }
@@ -699,37 +745,27 @@ public class Area extends SubCommand {
699
745
  percent = claimed == 0 ? 0 : (double) claimed / Short.MAX_VALUE * Short.MAX_VALUE;
700
746
  region = "N/A";
701
747
  }
702
- Template claimedTemplate = Template.of("claimed", String.valueOf(claimed));
703
- Template usageTemplate = Template.of("usage", String.format("%.2f", percent) + "%");
704
- Template clustersTemplate = Template.of("clusters", String.valueOf(clusters));
705
- Template regionTemplate = Template.of("region", region);
706
- Template generatorTemplate = Template.of("generator", generator);
707
- String tooltip = MINI_MESSAGE.serialize(MINI_MESSAGE
708
- .parse(
709
- TranslatableCaption.of("info.area_list_tooltip").getComponent(player),
710
- claimedTemplate,
711
- usageTemplate,
712
- clustersTemplate,
713
- regionTemplate,
714
- generatorTemplate
715
- ));
716
- Template tooltipTemplate = Template.of("hover_info", tooltip);
717
- Template visitcmdTemplate = Template.of("command_tp", "/plot area tp " + area);
718
- Template infocmdTemplate = Template.of("command_info", "/plot area info " + area);
719
- Template numberTemplate = Template.of("number", String.valueOf(i));
720
- Template nameTemplate = Template.of("area_name", name);
721
- Template typeTemplate = Template.of("area_type", area.getType().name());
722
- Template terrainTemplate = Template.of("area_terrain", area.getTerrain().name());
723
- caption.set(TranslatableCaption.of("info.area_list_item"));
724
- caption.setTemplates(
725
- tooltipTemplate,
726
- visitcmdTemplate,
727
- numberTemplate,
728
- nameTemplate,
729
- typeTemplate,
730
- terrainTemplate,
731
- infocmdTemplate
748
+ Component tooltip = MINI_MESSAGE.deserialize(
749
+ TranslatableCaption.of("info.area_list_tooltip").getComponent(player),
750
+ TagResolver.builder()
751
+ .tag("claimed", Tag.inserting(Component.text(claimed)))
752
+ .tag("usage", Tag.inserting(Component.text(String.format("%.2f", percent) + "%")))
753
+ .tag("clusters", Tag.inserting(Component.text(clusters)))
754
+ .tag("region", Tag.inserting(Component.text(region)))
755
+ .tag("generator", Tag.inserting(Component.text(generator)))
756
+ .build()
732
757
  );
758
+ TagResolver resolver = TagResolver.builder()
759
+ .tag("hover_info", Tag.inserting(tooltip))
760
+ .tag("command_tp", Tag.preProcessParsed("/plot area tp " + name))
761
+ .tag("command_info", Tag.preProcessParsed("/plot area info " + name))
762
+ .tag("number", Tag.inserting(Component.text(i)))
763
+ .tag("area_name", Tag.inserting(Component.text(name)))
764
+ .tag("area_type", Tag.inserting(Component.text(area.getType().name())))
765
+ .tag("area_terrain", Tag.inserting(Component.text(area.getTerrain().name())))
766
+ .build();
767
+ caption.set(TranslatableCaption.of("info.area_list_item"));
768
+ caption.setTagResolvers(resolver);
733
769
  }
734
770
  }, "/plot area list", TranslatableCaption.of("list.area_list_header_paged"));
735
771
  return true;
@@ -738,7 +774,10 @@ public class Area extends SubCommand {
738
774
  if (!player.hasPermission(Permission.PERMISSION_AREA_REGEN)) {
739
775
  player.sendMessage(
740
776
  TranslatableCaption.of("permission.no_permission"),
741
- Template.of("node", String.valueOf(Permission.PERMISSION_AREA_REGEN))
777
+ TagResolver.resolver(
778
+ "node",
779
+ Tag.inserting(Permission.PERMISSION_AREA_REGEN)
780
+ )
742
781
  );
743
782
  return false;
744
783
  }
@@ -750,13 +789,12 @@ public class Area extends SubCommand {
750
789
  if (area.getType() != PlotAreaType.PARTIAL) {
751
790
  player.sendMessage(
752
791
  TranslatableCaption.of("single.delete_world_region"),
753
- Template.of("world", area.getWorldName())
792
+ TagResolver.resolver("world", Tag.inserting(Component.text(area.getWorldName())))
754
793
  );
755
794
  return false;
756
795
  }
757
796
  QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(area.getWorldName()));
758
- queue.setChunkConsumer(chunk -> AugmentedUtils.generate(
759
- null,
797
+ queue.setChunkConsumer(chunk -> AugmentedUtils.generateChunk(
760
798
  area.getWorldName(),
761
799
  chunk.getX(),
762
800
  chunk.getZ(),
@@ -771,20 +809,23 @@ public class Area extends SubCommand {
771
809
  if (!player.hasPermission(Permission.PERMISSION_AREA_TP)) {
772
810
  player.sendMessage(
773
811
  TranslatableCaption.of("permission.no_permission"),
774
- Template.of("node", String.valueOf(Permission.PERMISSION_AREA_TP))
812
+ TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_AREA_TP))
775
813
  );
776
814
  return false;
777
815
  }
778
816
  if (args.length != 2) {
779
817
  player.sendMessage(
780
818
  TranslatableCaption.of("commandconfig.command_syntax"),
781
- Template.of("value", "/plot area tp [area]")
819
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot area tp [area]")))
782
820
  );
783
821
  return false;
784
822
  }
785
823
  PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
786
824
  if (area == null) {
787
- player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1]));
825
+ player.sendMessage(
826
+ TranslatableCaption.of("errors.not_valid_plot_world"),
827
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
828
+ );
788
829
  return false;
789
830
  }
790
831
  Location center;
Core/src/main/java/com/plotsquared/core/command/Auto.java CHANGED
@@ -43,7 +43,9 @@ import com.plotsquared.core.util.task.AutoClaimFinishTask;
43
43
  import com.plotsquared.core.util.task.RunnableVal;
44
44
  import com.plotsquared.core.util.task.TaskManager;
45
45
  import io.leangen.geantyref.TypeToken;
46
- import net.kyori.adventure.text.minimessage.Template;
46
+ import net.kyori.adventure.text.Component;
47
+ import net.kyori.adventure.text.minimessage.tag.Tag;
48
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
47
49
  import org.checkerframework.checker.nullness.qual.NonNull;
48
50
  import org.checkerframework.checker.nullness.qual.Nullable;
49
51
 
@@ -109,13 +111,13 @@ public class Auto extends SubCommand {
109
111
  if (diff < 0 && grantedPlots < sizeX * sizeZ) {
110
112
  player.sendMessage(
111
113
  TranslatableCaption.of("permission.cant_claim_more_plots"),
112
- Template.of("amount", String.valueOf(diff + grantedPlots))
114
+ TagResolver.resolver("amount", Tag.inserting(Component.text(diff + grantedPlots)))
113
115
  );
114
116
  return false;
115
117
  } else if (diff >= 0 && grantedPlots + diff < sizeX * sizeZ) {
116
118
  player.sendMessage(
117
119
  TranslatableCaption.of("permission.cant_claim_more_plots"),
118
- Template.of("amount", String.valueOf(diff + grantedPlots))
120
+ TagResolver.resolver("amount", Tag.inserting(Component.text(diff + grantedPlots)))
119
121
  );
120
122
  return false;
121
123
  } else {
@@ -127,15 +129,16 @@ public class Auto extends SubCommand {
127
129
  }
128
130
  player.sendMessage(
129
131
  TranslatableCaption.of("economy.removed_granted_plot"),
130
- Template.of("usedGrants", String.valueOf(grantedPlots - left)),
131
- Template.of("remainingGrants", String.valueOf(left))
132
+ TagResolver.builder()
133
+ .tag("usedGrants", Tag.inserting(Component.text(grantedPlots - left)))
134
+ .tag("remainingGrants", Tag.inserting(Component.text(left)))
135
+ .build()
132
136
  );
133
137
  }
134
138
  } else {
135
139
  player.sendMessage(
136
140
  TranslatableCaption.of("permission.cant_claim_more_plots"),
137
- Template.of("amount", String.valueOf(player.getAllowedPlots())
138
- )
141
+ TagResolver.resolver("amount", Tag.inserting(Component.text(player.getAllowedPlots())))
139
142
  );
140
143
  return false;
141
144
  }
@@ -214,7 +217,7 @@ public class Auto extends SubCommand {
214
217
  } else {
215
218
  player.sendMessage(
216
219
  TranslatableCaption.of("commandconfig.command_syntax"),
217
- Template.of("value", getUsage())
220
+ TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
218
221
  );
219
222
  return true;
220
223
  }
@@ -237,7 +240,7 @@ public class Auto extends SubCommand {
237
240
  if (event.getEventResult() == Result.DENY) {
238
241
  player.sendMessage(
239
242
  TranslatableCaption.of("events.event_denied"),
240
- Template.of("value", "Auto claim")
243
+ TagResolver.resolver("value", Tag.inserting(Component.text("Auto claim")))
241
244
  );
242
245
  return true;
243
246
  }
@@ -248,14 +251,14 @@ public class Auto extends SubCommand {
248
251
  if (!force && mega && !player.hasPermission(Permission.PERMISSION_AUTO_MEGA)) {
249
252
  player.sendMessage(
250
253
  TranslatableCaption.of("permission.no_permission"),
251
- Template.of("node", String.valueOf(Permission.PERMISSION_AUTO_MEGA))
254
+ TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_AUTO_MEGA))
252
255
  );
253
256
  return false;
254
257
  }
255
258
  if (!force && sizeX * sizeZ > Settings.Claim.MAX_AUTO_AREA) {
256
259
  player.sendMessage(
257
260
  TranslatableCaption.of("permission.cant_claim_more_plots_num"),
258
- Template.of("amount", String.valueOf(Settings.Claim.MAX_AUTO_AREA))
261
+ TagResolver.resolver("amount", Tag.inserting(Component.text(Settings.Claim.MAX_AUTO_AREA)))
259
262
  );
260
263
  return false;
261
264
  }
@@ -273,8 +276,10 @@ public class Auto extends SubCommand {
273
276
  if (!plotarea.hasSchematic(schematic)) {
274
277
  player.sendMessage(
275
278
  TranslatableCaption.of("schematics.schematic_invalid_named"),
276
- Template.of("schemname", schematic),
277
- Template.of("reason", "non-existent")
279
+ TagResolver.builder()
280
+ .tag("schemname", Tag.inserting(Component.text(schematic)))
281
+ .tag("reason", Tag.inserting(Component.text("non-existent")))
282
+ .build()
278
283
  );
279
284
  return true;
280
285
  }
@@ -283,7 +288,7 @@ public class Auto extends SubCommand {
283
288
  ) && !player.hasPermission("plots.admin.command.schematic")) {
284
289
  player.sendMessage(
285
290
  TranslatableCaption.of("permission.no_permission"),
286
- Template.of("node", "plots.claim.%s0")
291
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.claim.%s0")))
287
292
  );
288
293
  return true;
289
294
  }
@@ -302,15 +307,20 @@ public class Auto extends SubCommand {
302
307
  if (!force && this.econHandler.getMoney(player) < cost) {
303
308
  player.sendMessage(
304
309
  TranslatableCaption.of("economy.cannot_afford_plot"),
305
- Template.of("money", this.econHandler.format(cost)),
306
- Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
310
+ TagResolver.builder()
311
+ .tag("money", Tag.inserting(Component.text(this.econHandler.format(cost))))
312
+ .tag(
313
+ "balance",
314
+ Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(player))))
315
+ )
316
+ .build()
307
317
  );
308
318
  return false;
309
319
  }
310
320
  this.econHandler.withdrawMoney(player, cost);
311
321
  player.sendMessage(
312
322
  TranslatableCaption.of("economy.removed_balance"),
313
- Template.of("money", this.econHandler.format(cost))
323
+ TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(cost))))
314
324
  );
315
325
  }
316
326
  }
@@ -344,7 +354,7 @@ public class Auto extends SubCommand {
344
354
  if (!force && mergeEvent.getEventResult() == Result.DENY) {
345
355
  player.sendMessage(
346
356
  TranslatableCaption.of("events.event_denied"),
347
- Template.of("value", "Auto merge")
357
+ TagResolver.resolver("value", Tag.inserting(Component.text("Auto merge")))
348
358
  );
349
359
  return false;
350
360
  }
Core/src/main/java/com/plotsquared/core/command/Backup.java CHANGED
@@ -29,7 +29,9 @@ import com.plotsquared.core.player.PlotPlayer;
29
29
  import com.plotsquared.core.plot.Plot;
30
30
  import com.plotsquared.core.util.task.RunnableVal2;
31
31
  import com.plotsquared.core.util.task.RunnableVal3;
32
- import net.kyori.adventure.text.minimessage.Template;
32
+ import net.kyori.adventure.text.Component;
33
+ import net.kyori.adventure.text.minimessage.tag.Tag;
34
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
33
35
  import org.checkerframework.checker.nullness.qual.NonNull;
34
36
 
35
37
  import java.nio.file.Files;
@@ -66,7 +68,7 @@ public final class Backup extends Command {
66
68
  private static boolean sendMessage(PlotPlayer<?> player) {
67
69
  player.sendMessage(
68
70
  TranslatableCaption.of("commandconfig.command_syntax"),
69
- Template.of("value", "/plot backup <save | list | load>")
71
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot backup <save | list | load>")))
70
72
  );
71
73
  return true;
72
74
  }
@@ -134,33 +136,44 @@ public final class Backup extends Command {
134
136
  } else if (!plot.hasOwner()) {
135
137
  player.sendMessage(
136
138
  TranslatableCaption.of("backups.backup_impossible"),
137
- Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player))
139
+ TagResolver.resolver("plot", Tag.inserting(
140
+ TranslatableCaption.of("generic.generic_unowned").toComponent(player)
141
+ ))
138
142
  );
139
143
  } else if (plot.getVolume() > Integer.MAX_VALUE) {
140
144
  player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
141
145
  } else if (plot.isMerged()) {
142
146
  player.sendMessage(
143
147
  TranslatableCaption.of("backups.backup_impossible"),
144
- Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player))
148
+ TagResolver.resolver("plot", Tag.inserting(
149
+ TranslatableCaption.of("generic.generic_merged").toComponent(player)
150
+ ))
145
151
  );
146
152
  } else if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
147
153
  player.sendMessage(
148
154
  TranslatableCaption.of("permission.no_permission"),
149
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
155
+ TagResolver.resolver(
156
+ "node",
157
+ Tag.inserting(Permission.PERMISSION_ADMIN_BACKUP_OTHER)
158
+ )
150
159
  );
151
160
  } else {
152
161
  final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
153
162
  if (backupProfile instanceof NullBackupProfile) {
154
163
  player.sendMessage(
155
164
  TranslatableCaption.of("backups.backup_impossible"),
156
- Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player))
165
+ TagResolver.resolver(
166
+ "plot", Tag.inserting(TranslatableCaption
167
+ .of("generic.generic_other")
168
+ .toComponent(player))
169
+ )
157
170
  );
158
171
  } else {
159
172
  backupProfile.createBackup().whenComplete((backup, throwable) -> {
160
173
  if (throwable != null) {
161
174
  player.sendMessage(
162
175
  TranslatableCaption.of("backups.backup_save_failed"),
163
- Template.of("reason", throwable.getMessage())
176
+ TagResolver.resolver("reason", Tag.inserting(Component.text(throwable.getMessage())))
164
177
  );
165
178
  throwable.printStackTrace();
166
179
  } else {
@@ -187,49 +200,64 @@ public final class Backup extends Command {
187
200
  } else if (!plot.hasOwner()) {
188
201
  player.sendMessage(
189
202
  TranslatableCaption.of("backups.backup_impossible"),
190
- Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player))
203
+ TagResolver.resolver("plot", Tag.inserting(
204
+ TranslatableCaption.of("generic.generic_unowned").toComponent(player)
205
+ ))
191
206
  );
192
207
  } else if (plot.isMerged()) {
193
208
  player.sendMessage(
194
209
  TranslatableCaption.of("backups.backup_impossible"),
195
- Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player))
210
+ TagResolver.resolver("plot", Tag.inserting(
211
+ TranslatableCaption.of("generic.generic_merged").toComponent(player)
212
+ ))
196
213
  );
197
214
  } else if (plot.getVolume() > Integer.MAX_VALUE) {
198
215
  player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
199
216
  } else if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
200
217
  player.sendMessage(
201
218
  TranslatableCaption.of("permission.no_permission"),
202
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
219
+ TagResolver.resolver(
220
+ "node",
221
+ Tag.inserting(Permission.PERMISSION_ADMIN_BACKUP_OTHER)
222
+ )
203
223
  );
204
224
  } else {
205
225
  final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
206
226
  if (backupProfile instanceof NullBackupProfile) {
207
227
  player.sendMessage(
208
228
  TranslatableCaption.of("backups.backup_impossible"),
209
- Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player))
229
+ TagResolver.resolver("plot", Tag.inserting(
230
+ TranslatableCaption.of("generic.generic_other").toComponent(player)
231
+ ))
210
232
  );
211
233
  } else {
212
234
  backupProfile.listBackups().whenComplete((backups, throwable) -> {
213
235
  if (throwable != null) {
214
236
  player.sendMessage(
215
237
  TranslatableCaption.of("backups.backup_list_failed"),
216
- Template.of("reason", throwable.getMessage())
238
+ TagResolver.resolver("reason", Tag.inserting(Component.text(throwable.getMessage())))
217
239
  );
218
240
  throwable.printStackTrace();
219
241
  } else {
220
242
  player.sendMessage(
221
243
  TranslatableCaption.of("backups.backup_list_header"),
222
- Template.of("plot", plot.getId().toCommaSeparatedString())
244
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toCommaSeparatedString())))
223
245
  );
224
246
  try {
225
247
  for (int i = 0; i < backups.size(); i++) {
226
248
  player.sendMessage(
227
249
  TranslatableCaption.of("backups.backup_list_entry"),
228
- Template.of("number", Integer.toString(i + 1)),
229
- Template.of("value", DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant(
230
- Instant.ofEpochMilli(backups.get(i).getCreationTime()),
231
- ZoneId.systemDefault()
232
- )))
250
+ TagResolver.builder()
251
+ .tag("number", Tag.inserting(Component.text(i + 1)))
252
+ .tag(
253
+ "value",
254
+ Tag.inserting(Component.text(DateTimeFormatter.RFC_1123_DATE_TIME.format(
255
+ ZonedDateTime.ofInstant(
256
+ Instant.ofEpochMilli(backups.get(i).getCreationTime()),
257
+ ZoneId.systemDefault()
258
+ ))))
259
+ )
260
+ .build()
233
261
  );
234
262
  }
235
263
  } catch (final Exception e) {
@@ -257,24 +285,31 @@ public final class Backup extends Command {
257
285
  } else if (!plot.hasOwner()) {
258
286
  player.sendMessage(
259
287
  TranslatableCaption.of("backups.backup_impossible"),
260
- Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player))
288
+ TagResolver.resolver("plot", Tag.inserting(
289
+ TranslatableCaption.of("generic.generic_unowned").toComponent(player)
290
+ ))
261
291
  );
262
292
  } else if (plot.isMerged()) {
263
293
  player.sendMessage(
264
294
  TranslatableCaption.of("backups.backup_impossible"),
265
- Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player))
295
+ TagResolver.resolver("plot", Tag.inserting(
296
+ TranslatableCaption.of("generic.generic_merged").toComponent(player)
297
+ ))
266
298
  );
267
299
  } else if (plot.getVolume() > Integer.MAX_VALUE) {
268
300
  player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
269
301
  } else if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
270
302
  player.sendMessage(
271
303
  TranslatableCaption.of("permission.no_permission"),
272
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
304
+ TagResolver.resolver(
305
+ "node",
306
+ Tag.inserting(Permission.PERMISSION_ADMIN_BACKUP_OTHER)
307
+ )
273
308
  );
274
309
  } else if (args.length == 0) {
275
310
  player.sendMessage(
276
311
  TranslatableCaption.of("commandconfig.command_syntax"),
277
- Template.of("value", "Usage: /plot backup save/list/load")
312
+ TagResolver.resolver("value", Tag.inserting(Component.text("Usage: /plot backup save/list/load")))
278
313
  );
279
314
  } else {
280
315
  final int number;
@@ -283,7 +318,7 @@ public final class Backup extends Command {
283
318
  } catch (final Exception e) {
284
319
  player.sendMessage(
285
320
  TranslatableCaption.of("invalid.not_a_number"),
286
- Template.of("value", args[0])
321
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
287
322
  );
288
323
  return;
289
324
  }
@@ -291,23 +326,27 @@ public final class Backup extends Command {
291
326
  if (backupProfile instanceof NullBackupProfile) {
292
327
  player.sendMessage(
293
328
  TranslatableCaption.of("backups.backup_impossible"),
294
- Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player))
329
+ TagResolver.resolver("plot", Tag.inserting(
330
+ TranslatableCaption.of("generic.generic_other").toComponent(player)
331
+ ))
295
332
  );
296
333
  } else {
297
334
  backupProfile.listBackups().whenComplete((backups, throwable) -> {
298
335
  if (throwable != null) {
299
336
  player.sendMessage(
300
337
  TranslatableCaption.of("backups.backup_load_failure"),
301
- Template.of("reason", throwable.getMessage())
338
+ TagResolver.resolver("reason", Tag.inserting(Component.text(throwable.getMessage())))
302
339
  );
303
340
  throwable.printStackTrace();
304
341
  } else {
305
342
  if (number < 1 || number > backups.size()) {
306
343
  player.sendMessage(
307
344
  TranslatableCaption.of("backups.backup_impossible"),
308
- Template.of(
345
+ TagResolver.resolver(
309
346
  "plot",
310
- TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player)
347
+ Tag.inserting(TranslatableCaption
348
+ .of("generic.generic_invalid_choice")
349
+ .toComponent(player))
311
350
  )
312
351
  );
313
352
  } else {
@@ -317,9 +356,11 @@ public final class Backup extends Command {
317
356
  .exists(backup.getFile())) {
318
357
  player.sendMessage(
319
358
  TranslatableCaption.of("backups.backup_impossible"),
320
- Template.of(
359
+ TagResolver.resolver(
321
360
  "plot",
322
- TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player)
361
+ Tag.inserting(TranslatableCaption
362
+ .of("generic.generic_invalid_choice")
363
+ .toComponent(player))
323
364
  )
324
365
  );
325
366
  } else {
@@ -329,7 +370,10 @@ public final class Backup extends Command {
329
370
  if (error != null) {
330
371
  player.sendMessage(
331
372
  TranslatableCaption.of("backups.backup_load_failure"),
332
- Template.of("reason", error.getMessage())
373
+ TagResolver.resolver(
374
+ "reason",
375
+ Tag.inserting(Component.text(error.getMessage()))
376
+ )
333
377
  );
334
378
  } else {
335
379
  player.sendMessage(TranslatableCaption.of("backups.backup_load_success"));
Core/src/main/java/com/plotsquared/core/command/Biome.java CHANGED
@@ -18,6 +18,7 @@
18
18
  */
19
19
  package com.plotsquared.core.command;
20
20
 
21
+ import com.plotsquared.core.configuration.caption.StaticCaption;
21
22
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
22
23
  import com.plotsquared.core.player.PlotPlayer;
23
24
  import com.plotsquared.core.plot.Plot;
@@ -25,7 +26,9 @@ import com.plotsquared.core.util.StringMan;
25
26
  import com.sk89q.worldedit.command.util.SuggestionHelper;
26
27
  import com.sk89q.worldedit.world.biome.BiomeType;
27
28
  import com.sk89q.worldedit.world.biome.BiomeTypes;
28
- import net.kyori.adventure.text.minimessage.Template;
29
+ import net.kyori.adventure.text.Component;
30
+ import net.kyori.adventure.text.minimessage.tag.Tag;
31
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
29
32
 
30
33
  import java.util.Collection;
31
34
  import java.util.Locale;
@@ -47,16 +50,13 @@ public class Biome extends SetCommand {
47
50
  } catch (final Exception ignore) {
48
51
  }
49
52
  if (biome == null) {
50
- String biomes = StringMan.join(
51
- BiomeType.REGISTRY.values(),
52
- MINI_MESSAGE.serialize(MINI_MESSAGE.parse(TranslatableCaption
53
- .of("blocklist.block_list_separator")
54
- .getComponent(player)))
55
- );
53
+ String separator = TranslatableCaption.of("blocklist.block_list_separator").getComponent(player);
56
54
  player.sendMessage(TranslatableCaption.of("biome.need_biome"));
57
55
  player.sendMessage(
58
- TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
59
- Template.of("values", biomes)
56
+ StaticCaption.of(
57
+ TranslatableCaption.of("commandconfig.subcommand_set_options_header_only").getComponent(player)
58
+ + StringMan.join(BiomeType.REGISTRY.values(), separator)
59
+ )
60
60
  );
61
61
  return false;
62
62
  }
@@ -73,7 +73,7 @@ public class Biome extends SetCommand {
73
73
  plot.removeRunning();
74
74
  player.sendMessage(
75
75
  TranslatableCaption.of("biome.biome_set_to"),
76
- Template.of("value", value.toLowerCase())
76
+ TagResolver.resolver("value", Tag.inserting(Component.text(value.toLowerCase())))
77
77
  );
78
78
  });
79
79
  return true;
Core/src/main/java/com/plotsquared/core/command/Buy.java CHANGED
@@ -32,7 +32,9 @@ import com.plotsquared.core.util.EconHandler;
32
32
  import com.plotsquared.core.util.EventDispatcher;
33
33
  import com.plotsquared.core.util.task.RunnableVal2;
34
34
  import com.plotsquared.core.util.task.RunnableVal3;
35
- import net.kyori.adventure.text.minimessage.Template;
35
+ import net.kyori.adventure.text.Component;
36
+ import net.kyori.adventure.text.minimessage.tag.Tag;
37
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
36
38
  import org.checkerframework.checker.nullness.qual.NonNull;
37
39
 
38
40
  import java.util.Set;
@@ -84,7 +86,7 @@ public class Buy extends Command {
84
86
  checkTrue(
85
87
  player.getPlotCount() + plots.size() <= player.getAllowedPlots(),
86
88
  TranslatableCaption.of("permission.cant_claim_more_plots"),
87
- Template.of("amount", String.valueOf(player.getAllowedPlots()))
89
+ TagResolver.resolver("amount", Tag.inserting(Component.text(player.getAllowedPlots())))
88
90
  );
89
91
  double price = plot.getFlag(PriceFlag.class);
90
92
  if (price <= 0) {
@@ -97,8 +99,10 @@ public class Buy extends Command {
97
99
  checkTrue(
98
100
  this.econHandler.getMoney(player) >= price,
99
101
  TranslatableCaption.of("economy.cannot_afford_plot"),
100
- Template.of("money", this.econHandler.format(price)),
101
- Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
102
+ TagResolver.builder()
103
+ .tag("money", Tag.inserting(Component.text(this.econHandler.format(price))))
104
+ .tag("balance", Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(player)))))
105
+ .build()
102
106
  );
103
107
  this.econHandler.withdrawMoney(player, price);
104
108
  // Failure
@@ -106,7 +110,7 @@ public class Buy extends Command {
106
110
  confirm.run(this, () -> {
107
111
  player.sendMessage(
108
112
  TranslatableCaption.of("economy.removed_balance"),
109
- Template.of("money", this.econHandler.format(price))
113
+ TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
110
114
  );
111
115
 
112
116
  this.econHandler.depositMoney(PlotSquared.platform().playerManager().getOfflinePlayer(plot.getOwnerAbs()), price);
@@ -115,9 +119,11 @@ public class Buy extends Command {
115
119
  if (owner != null) {
116
120
  owner.sendMessage(
117
121
  TranslatableCaption.of("economy.plot_sold"),
118
- Template.of("plot", plot.getId().toString()),
119
- Template.of("player", player.getName()),
120
- Template.of("price", this.econHandler.format(price))
122
+ TagResolver.builder()
123
+ .tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
124
+ .tag("player", Tag.inserting(Component.text(player.getName())))
125
+ .tag("price", Tag.inserting(Component.text(this.econHandler.format(price))))
126
+ .build()
121
127
  );
122
128
  }
123
129
  PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class);
@@ -129,7 +135,7 @@ public class Buy extends Command {
129
135
  plot.getPlotModificationManager().setSign(player.getName());
130
136
  player.sendMessage(
131
137
  TranslatableCaption.of("working.claimed"),
132
- Template.of("plot", plot.getId().toString())
138
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
133
139
  );
134
140
  whenDone.run(Buy.this, CommandResult.SUCCESS);
135
141
  }, () -> {
Core/src/main/java/com/plotsquared/core/command/Caps.java CHANGED
@@ -29,7 +29,10 @@ import com.plotsquared.core.plot.flag.implementations.HostileCapFlag;
29
29
  import com.plotsquared.core.plot.flag.implementations.MiscCapFlag;
30
30
  import com.plotsquared.core.plot.flag.implementations.MobCapFlag;
31
31
  import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
32
- import net.kyori.adventure.text.minimessage.Template;
32
+ import net.kyori.adventure.text.Component;
33
+ import net.kyori.adventure.text.ComponentLike;
34
+ import net.kyori.adventure.text.minimessage.tag.Tag;
35
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
33
36
 
34
37
  import static com.plotsquared.core.util.entity.EntityCategories.CAP_ANIMAL;
35
38
  import static com.plotsquared.core.util.entity.EntityCategories.CAP_ENTITY;
@@ -53,7 +56,7 @@ public class Caps extends SubCommand {
53
56
  if (!plot.isAdded(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_CAPS_OTHER)) {
54
57
  player.sendMessage(
55
58
  TranslatableCaption.of("permission.no_permission"),
56
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_CAPS_OTHER))
59
+ TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_ADMIN_CAPS_OTHER))
57
60
  );
58
61
  return false;
59
62
  }
@@ -80,15 +83,17 @@ public class Caps extends SubCommand {
80
83
  final int current = countedEntities[type];
81
84
  final int max = plot.getFlag(capFlag);
82
85
  final String percentage = String.format("%.1f", 100 * ((float) current / max));
83
- String maxBeautified = max >= Integer.MAX_VALUE
84
- ? TranslatableCaption.of("info.infinite").getComponent(player)
85
- : String.valueOf(max);
86
+ ComponentLike maxBeautified = max >= Integer.MAX_VALUE
87
+ ? TranslatableCaption.of("info.infinite").toComponent(player)
88
+ : Component.text(max);
86
89
  player.sendMessage(
87
90
  TranslatableCaption.of("info.plot_caps_format"),
88
- Template.of("cap", name),
89
- Template.of("current", String.valueOf(current)),
90
- Template.of("limit", maxBeautified),
91
- Template.of("percentage", percentage)
91
+ TagResolver.builder()
92
+ .tag("cap", Tag.inserting(Component.text(name)))
93
+ .tag("current", Tag.inserting(Component.text(current)))
94
+ .tag("limit", Tag.inserting(maxBeautified))
95
+ .tag("percentage", Tag.inserting(Component.text(percentage)))
96
+ .build()
92
97
  );
93
98
  }
94
99
 
Core/src/main/java/com/plotsquared/core/command/Chat.java DELETED
@@ -1,54 +0,0 @@
1
- /*
2
- * PlotSquared, a land and world management plugin for Minecraft.
3
- * Copyright (C) IntellectualSites <https://intellectualsites.com>
4
- * Copyright (C) IntellectualSites team and contributors
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- */
19
- package com.plotsquared.core.command;
20
-
21
- import com.plotsquared.core.configuration.caption.TranslatableCaption;
22
- import com.plotsquared.core.player.PlotPlayer;
23
- import com.plotsquared.core.plot.PlotArea;
24
- import net.kyori.adventure.text.minimessage.Template;
25
-
26
- /**
27
- * @deprecated In favor of "/plot toggle chat" and
28
- * scheduled for removal within the next major release.
29
- */
30
- @Deprecated(forRemoval = true, since = "6.0.0")
31
- @CommandDeclaration(command = "chat",
32
- usage = "/plot chat",
33
- permission = "plots.chat",
34
- category = CommandCategory.CHAT,
35
- requiredType = RequiredType.PLAYER)
36
- public class Chat extends SubCommand {
37
-
38
- @Override
39
- public boolean onCommand(PlotPlayer<?> player, String[] args) {
40
- PlotArea area = player.getPlotAreaAbs();
41
- check(area, TranslatableCaption.of("errors.not_in_plot_world"));
42
- player.sendMessage(
43
- TranslatableCaption.of("errors.deprecated_commands"),
44
- Template.of("replacement", "/plot toggle chat")
45
- );
46
- if (player.getPlotAreaAbs().isForcingPlotChat()) {
47
- player.sendMessage(TranslatableCaption.of("chat.plot_chat_forced"));
48
- return true;
49
- }
50
- MainCommand.getInstance().toggle.chat(this, player, args, null, null);
51
- return true;
52
- }
53
-
54
- }
Core/src/main/java/com/plotsquared/core/command/Claim.java CHANGED
@@ -37,7 +37,9 @@ import com.plotsquared.core.util.EconHandler;
37
37
  import com.plotsquared.core.util.EventDispatcher;
38
38
  import com.plotsquared.core.util.PlotExpression;
39
39
  import com.plotsquared.core.util.task.TaskManager;
40
- import net.kyori.adventure.text.minimessage.Template;
40
+ import net.kyori.adventure.text.Component;
41
+ import net.kyori.adventure.text.minimessage.tag.Tag;
42
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
41
43
  import org.apache.logging.log4j.LogManager;
42
44
  import org.apache.logging.log4j.Logger;
43
45
  import org.checkerframework.checker.nullness.qual.NonNull;
@@ -81,7 +83,7 @@ public class Claim extends SubCommand {
81
83
  if (event.getEventResult() == Result.DENY) {
82
84
  player.sendMessage(
83
85
  TranslatableCaption.of("events.event_denied"),
84
- Template.of("value", "Claim")
86
+ TagResolver.resolver("value", Tag.inserting(Component.text("Claim")))
85
87
  );
86
88
  return true;
87
89
  }
@@ -100,14 +102,14 @@ public class Claim extends SubCommand {
100
102
  if (grants <= 0) {
101
103
  player.sendMessage(
102
104
  TranslatableCaption.of("permission.cant_claim_more_plots"),
103
- Template.of("amount", String.valueOf(grants))
105
+ TagResolver.resolver("amount", Tag.inserting(Component.text(grants)))
104
106
  );
105
107
  metaDataAccess.remove();
106
108
  }
107
109
  } else {
108
110
  player.sendMessage(
109
111
  TranslatableCaption.of("permission.cant_claim_more_plots"),
110
- Template.of("amount", String.valueOf(player.getAllowedPlots()))
112
+ TagResolver.resolver("amount", Tag.inserting(Component.text(player.getAllowedPlots())))
111
113
  );
112
114
  return false;
113
115
  }
@@ -122,8 +124,10 @@ public class Claim extends SubCommand {
122
124
  if (!area.hasSchematic(schematic)) {
123
125
  player.sendMessage(
124
126
  TranslatableCaption.of("schematics.schematic_invalid_named"),
125
- Template.of("schemname", schematic),
126
- Template.of("reason", "non-existent")
127
+ TagResolver.builder()
128
+ .tag("schemname", Tag.inserting(Component.text(schematic)))
129
+ .tag("reason", Tag.inserting(Component.text("non-existent")))
130
+ .build()
127
131
  );
128
132
  }
129
133
  if (!player.hasPermission(Permission.PERMISSION_CLAIM_SCHEMATIC
@@ -132,7 +136,7 @@ public class Claim extends SubCommand {
132
136
  ) && !force) {
133
137
  player.sendMessage(
134
138
  TranslatableCaption.of("permission.no_schematic_permission"),
135
- Template.of("value", schematic)
139
+ TagResolver.resolver("value", Tag.inserting(Component.text(schematic)))
136
140
  );
137
141
  }
138
142
  }
@@ -148,16 +152,28 @@ public class Claim extends SubCommand {
148
152
  if (this.econHandler.getMoney(player) < cost) {
149
153
  player.sendMessage(
150
154
  TranslatableCaption.of("economy.cannot_afford_plot"),
151
- Template.of("money", this.econHandler.format(cost)),
152
- Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
155
+ TagResolver.builder()
156
+ .tag("money", Tag.inserting(Component.text(this.econHandler.format(cost))))
157
+ .tag(
158
+ "balance",
159
+ Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(
160
+ player))))
161
+ )
162
+ .build()
153
163
  );
154
164
  return false;
155
165
  }
156
166
  this.econHandler.withdrawMoney(player, cost);
157
167
  player.sendMessage(
158
168
  TranslatableCaption.of("economy.removed_balance"),
159
- Template.of("money", this.econHandler.format(cost)),
160
- Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
169
+ TagResolver.builder()
170
+ .tag("money", Tag.inserting(Component.text(this.econHandler.format(cost))))
171
+ .tag(
172
+ "balance",
173
+ Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(
174
+ player))))
175
+ )
176
+ .build()
161
177
  );
162
178
  }
163
179
  }
@@ -169,8 +185,10 @@ public class Claim extends SubCommand {
169
185
  }
170
186
  player.sendMessage(
171
187
  TranslatableCaption.of("economy.removed_granted_plot"),
172
- Template.of("usedGrants", String.valueOf((grants - 1))),
173
- Template.of("remainingGrants", String.valueOf(grants))
188
+ TagResolver.builder()
189
+ .tag("usedGrants", Tag.inserting(Component.text(grants - 1)))
190
+ .tag("remainingGrants", Tag.inserting(Component.text(grants)))
191
+ .build()
174
192
  );
175
193
  }
176
194
  }
@@ -196,7 +214,7 @@ public class Claim extends SubCommand {
196
214
  if (mergeEvent.getEventResult() == Result.DENY) {
197
215
  player.sendMessage(
198
216
  TranslatableCaption.of("events.event_denied"),
199
- Template.of("value", "Auto merge on claim")
217
+ TagResolver.resolver("value", Tag.inserting(Component.text("Auto merge on claim")))
200
218
  );
201
219
  } else {
202
220
  if (plot.getPlotModificationManager().autoMerge(
Core/src/main/java/com/plotsquared/core/command/Clear.java CHANGED
@@ -35,7 +35,9 @@ import com.plotsquared.core.util.EventDispatcher;
35
35
  import com.plotsquared.core.util.task.RunnableVal2;
36
36
  import com.plotsquared.core.util.task.RunnableVal3;
37
37
  import com.plotsquared.core.util.task.TaskManager;
38
- import net.kyori.adventure.text.minimessage.Template;
38
+ import net.kyori.adventure.text.Component;
39
+ import net.kyori.adventure.text.minimessage.tag.Tag;
40
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
39
41
  import org.checkerframework.checker.nullness.qual.NonNull;
40
42
 
41
43
  import java.util.concurrent.CompletableFuture;
@@ -78,7 +80,7 @@ public class Clear extends Command {
78
80
  if (eventResult == Result.DENY) {
79
81
  player.sendMessage(
80
82
  TranslatableCaption.of("events.event_denied"),
81
- Template.of("value", "Clear")
83
+ TagResolver.resolver("value", Tag.inserting(Component.text("Clear")))
82
84
  );
83
85
  return CompletableFuture.completedFuture(true);
84
86
  }
@@ -130,8 +132,10 @@ public class Clear extends Command {
130
132
  }
131
133
  player.sendMessage(
132
134
  TranslatableCaption.of("working.clearing_done"),
133
- Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
134
- Template.of("plot", plot.getId().toString())
135
+ TagResolver.builder()
136
+ .tag("amount", Tag.inserting(Component.text(System.currentTimeMillis() - start)))
137
+ .tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
138
+ .build()
135
139
  );
136
140
  });
137
141
  });
Core/src/main/java/com/plotsquared/core/command/Cluster.java CHANGED
@@ -32,9 +32,14 @@ import com.plotsquared.core.plot.Plot;
32
32
  import com.plotsquared.core.plot.PlotArea;
33
33
  import com.plotsquared.core.plot.PlotCluster;
34
34
  import com.plotsquared.core.plot.PlotId;
35
+ import com.plotsquared.core.util.ComponentHelper;
35
36
  import com.plotsquared.core.util.TabCompletions;
36
37
  import com.plotsquared.core.util.query.PlotQuery;
37
- import net.kyori.adventure.text.minimessage.Template;
38
+ import net.kyori.adventure.text.Component;
39
+ import net.kyori.adventure.text.format.NamedTextColor;
40
+ import net.kyori.adventure.text.format.Style;
41
+ import net.kyori.adventure.text.minimessage.tag.Tag;
42
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
38
43
 
39
44
  import java.util.Collection;
40
45
  import java.util.Collections;
@@ -45,6 +50,7 @@ import java.util.Set;
45
50
  import java.util.UUID;
46
51
  import java.util.concurrent.TimeoutException;
47
52
  import java.util.stream.Collectors;
53
+ import java.util.stream.Stream;
48
54
 
49
55
  @CommandDeclaration(command = "cluster",
50
56
  aliases = "clusters",
@@ -53,18 +59,19 @@ import java.util.stream.Collectors;
53
59
  permission = "plots.cluster")
54
60
  public class Cluster extends SubCommand {
55
61
 
62
+ private static final Component[] AVAILABLE_ARGS = Stream.of(
63
+ "list", "create", "delete", "resize", "invite", "kick", "leave", "helpers", "tp", "sethome"
64
+ ).map(s -> Component.text(s).style(Style.style(NamedTextColor.DARK_AQUA))).toArray(Component[]::new);
65
+ private static final Component SEPARATOR = Component.text(", ").style(Style.style(NamedTextColor.GRAY));
66
+
67
+ // list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
56
68
  @Override
57
69
  public boolean onCommand(PlotPlayer<?> player, String[] args) {
58
-
59
- // list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
60
70
  if (args.length == 0) {
61
71
  // return arguments
62
72
  player.sendMessage(
63
73
  TranslatableCaption.of("cluster.cluster_available_args"),
64
- Template.of(
65
- "list",
66
- "<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>"
67
- )
74
+ TagResolver.resolver("list", Tag.inserting(ComponentHelper.join(AVAILABLE_ARGS, SEPARATOR)))
68
75
  );
69
76
  return false;
70
77
  }
@@ -75,14 +82,17 @@ public class Cluster extends SubCommand {
75
82
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_LIST)) {
76
83
  player.sendMessage(
77
84
  TranslatableCaption.of("permission.no_permission"),
78
- Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_LIST))
85
+ TagResolver.resolver(
86
+ "node",
87
+ Tag.inserting(Permission.PERMISSION_CLUSTER_LIST)
88
+ )
79
89
  );
80
90
  return false;
81
91
  }
82
92
  if (args.length != 1) {
83
93
  player.sendMessage(
84
94
  TranslatableCaption.of("commandconfig.command_syntax"),
85
- Template.of("value", "/plot cluster list")
95
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster list")))
86
96
  );
87
97
  return false;
88
98
  }
@@ -94,7 +104,7 @@ public class Cluster extends SubCommand {
94
104
  Set<PlotCluster> clusters = area.getClusters();
95
105
  player.sendMessage(
96
106
  TranslatableCaption.of("cluster.cluster_list_heading"),
97
- Template.of("amount", clusters.size() + "")
107
+ TagResolver.resolver("amount", Tag.inserting(Component.text(clusters.size())))
98
108
  );
99
109
  for (PlotCluster cluster : clusters) {
100
110
  // Ignore unmanaged clusters
@@ -102,22 +112,22 @@ public class Cluster extends SubCommand {
102
112
  if (player.getUUID().equals(cluster.owner)) {
103
113
  player.sendMessage(
104
114
  TranslatableCaption.of("cluster.cluster_list_element_owner"),
105
- Template.of("cluster", name)
115
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(name)))
106
116
  );
107
117
  } else if (cluster.helpers.contains(player.getUUID())) {
108
118
  player.sendMessage(
109
119
  TranslatableCaption.of("cluster.cluster_list_element_helpers"),
110
- Template.of("cluster", name)
120
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(name)))
111
121
  );
112
122
  } else if (cluster.invited.contains(player.getUUID())) {
113
123
  player.sendMessage(
114
124
  TranslatableCaption.of("cluster.cluster_list_element_invited"),
115
- Template.of("cluster", name)
125
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(name)))
116
126
  );
117
127
  } else {
118
128
  player.sendMessage(
119
129
  TranslatableCaption.of("cluster.cluster_list_element"),
120
- Template.of("cluster", cluster.toString())
130
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(cluster.toString())))
121
131
  );
122
132
  }
123
133
  }
@@ -128,7 +138,10 @@ public class Cluster extends SubCommand {
128
138
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_CREATE)) {
129
139
  player.sendMessage(
130
140
  TranslatableCaption.of("permission.no_permission"),
131
- Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_CREATE))
141
+ TagResolver.resolver(
142
+ "node",
143
+ Tag.inserting(Permission.PERMISSION_CLUSTER_CREATE)
144
+ )
132
145
  );
133
146
  return false;
134
147
  }
@@ -140,7 +153,10 @@ public class Cluster extends SubCommand {
140
153
  if (args.length != 4) {
141
154
  player.sendMessage(
142
155
  TranslatableCaption.of("commandconfig.command_syntax"),
143
- Template.of("value", "/plot cluster create <name> <id-bot> <id-top>")
156
+ TagResolver.resolver(
157
+ "value",
158
+ Tag.inserting(Component.text("/plot cluster create <name> <id-bot> <id-top>"))
159
+ )
144
160
  );
145
161
  return false;
146
162
  }
@@ -150,7 +166,7 @@ public class Cluster extends SubCommand {
150
166
  if (currentClusters >= player.getAllowedPlots()) {
151
167
  player.sendMessage(
152
168
  TranslatableCaption.of("permission.cant_claim_more_clusters"),
153
- Template.of("amount", String.valueOf(player.getAllowedPlots()))
169
+ TagResolver.resolver("amount", Tag.inserting(Component.text(player.getAllowedPlots())))
154
170
  );
155
171
  }
156
172
  PlotId pos1;
@@ -168,7 +184,7 @@ public class Cluster extends SubCommand {
168
184
  if (area.getCluster(name) != null) {
169
185
  player.sendMessage(
170
186
  TranslatableCaption.of("alias.alias_is_taken"),
171
- Template.of("alias", name)
187
+ TagResolver.resolver("alias", Tag.inserting(Component.text(name)))
172
188
  );
173
189
  return false;
174
190
  }
@@ -182,7 +198,7 @@ public class Cluster extends SubCommand {
182
198
  if (cluster != null) {
183
199
  player.sendMessage(
184
200
  TranslatableCaption.of("cluster.cluster_intersection"),
185
- Template.of("cluster", cluster.getName())
201
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(cluster.getName())))
186
202
  );
187
203
  return false;
188
204
  }
@@ -190,7 +206,7 @@ public class Cluster extends SubCommand {
190
206
  if (!area.contains(pos1) || !area.contains(pos2)) {
191
207
  player.sendMessage(
192
208
  TranslatableCaption.of("cluster.cluster_outside"),
193
- Template.of("area", String.valueOf(area))
209
+ TagResolver.resolver("area", Tag.inserting(Component.text(area.toString())))
194
210
  );
195
211
  return false;
196
212
  }
@@ -202,7 +218,10 @@ public class Cluster extends SubCommand {
202
218
  if (!plot.isOwner(uuid)) {
203
219
  player.sendMessage(
204
220
  TranslatableCaption.of("permission.no_permission"),
205
- Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_CREATE_OTHER))
221
+ TagResolver.resolver(
222
+ "node",
223
+ Tag.inserting(Permission.PERMISSION_CLUSTER_CREATE_OTHER)
224
+ )
206
225
  );
207
226
  return false;
208
227
  }
@@ -224,7 +243,10 @@ public class Cluster extends SubCommand {
224
243
  if (current + cluster.getArea() > allowed) {
225
244
  player.sendMessage(
226
245
  TranslatableCaption.of("permission.no_permission"),
227
- Template.of("node", Permission.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()))
246
+ TagResolver.resolver(
247
+ "node",
248
+ Tag.inserting(Component.text(Permission.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea())))
249
+ )
228
250
  );
229
251
  return false;
230
252
  }
@@ -243,7 +265,7 @@ public class Cluster extends SubCommand {
243
265
  }
244
266
  player.sendMessage(
245
267
  TranslatableCaption.of("cluster.cluster_created"),
246
- Template.of("name", name)
268
+ TagResolver.resolver("name", Tag.inserting(Component.text(name)))
247
269
  );
248
270
  return true;
249
271
  }
@@ -253,14 +275,17 @@ public class Cluster extends SubCommand {
253
275
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_DELETE)) {
254
276
  player.sendMessage(
255
277
  TranslatableCaption.of("permission.no_permission"),
256
- Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_DELETE))
278
+ TagResolver.resolver(
279
+ "node",
280
+ Tag.inserting(Permission.PERMISSION_CLUSTER_DELETE)
281
+ )
257
282
  );
258
283
  return false;
259
284
  }
260
285
  if (args.length != 1 && args.length != 2) {
261
286
  player.sendMessage(
262
287
  TranslatableCaption.of("commandconfig.command_syntax"),
263
- Template.of("value", "/plot cluster delete [name]")
288
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster delete [name]")))
264
289
  );
265
290
  return false;
266
291
  }
@@ -275,7 +300,7 @@ public class Cluster extends SubCommand {
275
300
  if (cluster == null) {
276
301
  player.sendMessage(
277
302
  TranslatableCaption.of("cluster.invalid_cluster_name"),
278
- Template.of("cluster", args[1])
303
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(args[1])))
279
304
  );
280
305
  return false;
281
306
  }
@@ -290,15 +315,18 @@ public class Cluster extends SubCommand {
290
315
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_DELETE_OTHER)) {
291
316
  player.sendMessage(
292
317
  TranslatableCaption.of("permission.no_permission"),
293
- Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_DELETE_OTHER))
318
+ TagResolver.resolver(
319
+ "node",
320
+ Tag.inserting(Permission.PERMISSION_CLUSTER_DELETE_OTHER)
321
+ )
294
322
  );
295
323
  return false;
296
324
  }
297
325
  }
298
326
  DBFunc.delete(cluster);
299
- player.sendMessage(TranslatableCaption.of("cluster.cluster_deleted"), Template.of(
327
+ player.sendMessage(TranslatableCaption.of("cluster.cluster_deleted"), TagResolver.resolver(
300
328
  "cluster",
301
- String.valueOf(cluster)
329
+ Tag.inserting(Component.text(cluster.toString()))
302
330
  ));
303
331
  return true;
304
332
  }
@@ -307,14 +335,17 @@ public class Cluster extends SubCommand {
307
335
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE)) {
308
336
  player.sendMessage(
309
337
  TranslatableCaption.of("permission.no_permission"),
310
- Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE))
338
+ TagResolver.resolver(
339
+ "node",
340
+ Tag.inserting(Permission.PERMISSION_CLUSTER_RESIZE)
341
+ )
311
342
  );
312
343
  return false;
313
344
  }
314
345
  if (args.length != 3) {
315
346
  player.sendMessage(
316
347
  TranslatableCaption.of("commandconfig.command_syntax"),
317
- Template.of("value", "/plot cluster resize [name]")
348
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster resize [name]")))
318
349
  );
319
350
  return false;
320
351
  }
@@ -347,7 +378,10 @@ public class Cluster extends SubCommand {
347
378
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE_OTHER)) {
348
379
  player.sendMessage(
349
380
  TranslatableCaption.of("permission.no_permission"),
350
- Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_OTHER))
381
+ TagResolver.resolver(
382
+ "node",
383
+ Tag.inserting(Permission.PERMISSION_CLUSTER_RESIZE_OTHER)
384
+ )
351
385
  );
352
386
  return false;
353
387
  }
@@ -357,13 +391,12 @@ public class Cluster extends SubCommand {
357
391
  if (intersect != null) {
358
392
  player.sendMessage(
359
393
  TranslatableCaption.of("cluster.cluster_intersection"),
360
- Template.of("cluster", intersect.getName())
394
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(intersect.getName())))
361
395
  );
362
396
  return false;
363
397
  }
364
398
  Set<Plot> existing = area.getPlotSelectionOwned(cluster.getP1(), cluster.getP2());
365
399
  Set<Plot> newPlots = area.getPlotSelectionOwned(pos1, pos2);
366
- // Set<Plot> removed = (HashSet<Plot>) existing.clone();
367
400
  Set<Plot> removed = new HashSet<>(existing);
368
401
 
369
402
  removed.removeAll(newPlots);
@@ -372,7 +405,10 @@ public class Cluster extends SubCommand {
372
405
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
373
406
  player.sendMessage(
374
407
  TranslatableCaption.of("permission.no_permission"),
375
- Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_SHRINK))
408
+ TagResolver.resolver(
409
+ "node",
410
+ Tag.inserting(Permission.PERMISSION_CLUSTER_RESIZE_SHRINK)
411
+ )
376
412
  );
377
413
  return false;
378
414
  }
@@ -382,7 +418,10 @@ public class Cluster extends SubCommand {
382
418
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
383
419
  player.sendMessage(
384
420
  TranslatableCaption.of("permission.no_permission"),
385
- Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_EXPAND))
421
+ TagResolver.resolver(
422
+ "node",
423
+ Tag.inserting(Permission.PERMISSION_CLUSTER_RESIZE_EXPAND)
424
+ )
386
425
  );
387
426
  return false;
388
427
  }
@@ -402,7 +441,9 @@ public class Cluster extends SubCommand {
402
441
  if (current + cluster.getArea() > allowed) {
403
442
  player.sendMessage(
404
443
  TranslatableCaption.of("permission.no_permission"),
405
- Template.of("node", Permission.PERMISSION_CLUSTER + "." + (current + cluster.getArea()))
444
+ TagResolver.resolver("node", Tag.inserting(Component.text(
445
+ Permission.PERMISSION_CLUSTER + "." + (current + cluster.getArea())
446
+ )))
406
447
  );
407
448
  return false;
408
449
  }
@@ -417,14 +458,17 @@ public class Cluster extends SubCommand {
417
458
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INVITE)) {
418
459
  player.sendMessage(
419
460
  TranslatableCaption.of("permission.no_permission"),
420
- Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_INVITE))
461
+ TagResolver.resolver(
462
+ "node",
463
+ Tag.inserting(Permission.PERMISSION_CLUSTER_INVITE)
464
+ )
421
465
  );
422
466
  return false;
423
467
  }
424
468
  if (args.length != 2) {
425
469
  player.sendMessage(
426
470
  TranslatableCaption.of("commandconfig.command_syntax"),
427
- Template.of("value", "/plot cluster invite <player>")
471
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster invite <player>")))
428
472
  );
429
473
  return false;
430
474
  }
@@ -442,7 +486,10 @@ public class Cluster extends SubCommand {
442
486
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INVITE_OTHER)) {
443
487
  player.sendMessage(
444
488
  TranslatableCaption.of("permission.no_permission"),
445
- Template.of("node", Permission.PERMISSION_CLUSTER_INVITE_OTHER.toString())
489
+ TagResolver.resolver(
490
+ "node",
491
+ Tag.inserting(Permission.PERMISSION_CLUSTER_INVITE_OTHER)
492
+ )
446
493
  );
447
494
  return false;
448
495
  }
@@ -455,7 +502,7 @@ public class Cluster extends SubCommand {
455
502
  } else if (throwable != null) {
456
503
  player.sendMessage(
457
504
  TranslatableCaption.of("errors.invalid_player"),
458
- Template.of("value", args[1])
505
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
459
506
  );
460
507
  } else {
461
508
  if (!cluster.isAdded(uuid)) {
@@ -467,7 +514,7 @@ public class Cluster extends SubCommand {
467
514
  if (otherPlayer != null) {
468
515
  player.sendMessage(
469
516
  TranslatableCaption.of("cluster.cluster_invited"),
470
- Template.of("cluster", cluster.getName())
517
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(cluster.getName())))
471
518
  );
472
519
  }
473
520
  }
@@ -482,14 +529,17 @@ public class Cluster extends SubCommand {
482
529
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_KICK)) {
483
530
  player.sendMessage(
484
531
  TranslatableCaption.of("permission.no_permission"),
485
- Template.of("node", Permission.PERMISSION_CLUSTER_KICK.toString())
532
+ TagResolver.resolver(
533
+ "node",
534
+ Tag.inserting(Permission.PERMISSION_CLUSTER_KICK)
535
+ )
486
536
  );
487
537
  return false;
488
538
  }
489
539
  if (args.length != 2) {
490
540
  player.sendMessage(
491
541
  TranslatableCaption.of("commandconfig.command_syntax"),
492
- Template.of("value", "/plot cluster kick <player>")
542
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster kick <player>")))
493
543
  );
494
544
  return false;
495
545
  }
@@ -506,7 +556,10 @@ public class Cluster extends SubCommand {
506
556
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_KICK_OTHER)) {
507
557
  player.sendMessage(
508
558
  TranslatableCaption.of("permission.no_permission"),
509
- Template.of("node", Permission.PERMISSION_CLUSTER_KICK_OTHER.toString())
559
+ TagResolver.resolver(
560
+ "node",
561
+ Tag.inserting(Permission.PERMISSION_CLUSTER_KICK_OTHER)
562
+ )
510
563
  );
511
564
  return false;
512
565
  }
@@ -519,7 +572,7 @@ public class Cluster extends SubCommand {
519
572
  } else if (throwable != null) {
520
573
  player.sendMessage(
521
574
  TranslatableCaption.of("errors.invalid_player"),
522
- Template.of("value", args[1])
575
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
523
576
  );
524
577
  } else {
525
578
  // Can't kick if the player is yourself, the owner, or not added to the cluster
@@ -527,7 +580,7 @@ public class Cluster extends SubCommand {
527
580
  || !cluster.isAdded(uuid)) {
528
581
  player.sendMessage(
529
582
  TranslatableCaption.of("cluster.cannot_kick_player"),
530
- Template.of("value", cluster.getName())
583
+ TagResolver.resolver("value", Tag.inserting(Component.text(cluster.getName())))
531
584
  );
532
585
  } else {
533
586
  if (cluster.helpers.contains(uuid)) {
@@ -542,7 +595,7 @@ public class Cluster extends SubCommand {
542
595
  if (player2 != null) {
543
596
  player.sendMessage(
544
597
  TranslatableCaption.of("cluster.cluster_removed"),
545
- Template.of("cluster", cluster.getName())
598
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(cluster.getName())))
546
599
  );
547
600
  }
548
601
  removePlayerPlots(cluster, uuid, player2.getLocation().getWorldName());
@@ -557,14 +610,17 @@ public class Cluster extends SubCommand {
557
610
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_LEAVE)) {
558
611
  player.sendMessage(
559
612
  TranslatableCaption.of("permission.no_permission"),
560
- Template.of("node", Permission.PERMISSION_CLUSTER_LEAVE.toString())
613
+ TagResolver.resolver(
614
+ "node",
615
+ Tag.inserting(Permission.PERMISSION_CLUSTER_LEAVE)
616
+ )
561
617
  );
562
618
  return false;
563
619
  }
564
620
  if (args.length != 1 && args.length != 2) {
565
621
  player.sendMessage(
566
622
  TranslatableCaption.of("commandconfig.command_syntax"),
567
- Template.of("value", "/plot cluster leave [name]")
623
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster leave [name]")))
568
624
  );
569
625
  return false;
570
626
  }
@@ -578,7 +634,7 @@ public class Cluster extends SubCommand {
578
634
  if (cluster == null) {
579
635
  player.sendMessage(
580
636
  TranslatableCaption.of("cluster.invalid_cluster_name"),
581
- Template.of("cluster", args[1])
637
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(args[1])))
582
638
  );
583
639
  return false;
584
640
  }
@@ -606,7 +662,7 @@ public class Cluster extends SubCommand {
606
662
  DBFunc.removeInvited(cluster, uuid);
607
663
  player.sendMessage(
608
664
  TranslatableCaption.of("cluster.cluster_removed"),
609
- Template.of("cluster", cluster.getName())
665
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(cluster.getName())))
610
666
  );
611
667
  removePlayerPlots(cluster, uuid, player.getLocation().getWorldName());
612
668
  return true;
@@ -615,14 +671,20 @@ public class Cluster extends SubCommand {
615
671
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_HELPERS)) {
616
672
  player.sendMessage(
617
673
  TranslatableCaption.of("permission.no_permission"),
618
- Template.of("node", Permission.PERMISSION_CLUSTER_HELPERS.toString())
674
+ TagResolver.resolver(
675
+ "node",
676
+ Tag.inserting(Component.text(Permission.PERMISSION_CLUSTER_HELPERS.toString()))
677
+ )
619
678
  );
620
679
  return false;
621
680
  }
622
681
  if (args.length != 3) {
623
682
  player.sendMessage(
624
683
  TranslatableCaption.of("commandconfig.command_syntax"),
625
- Template.of("value", "/plot cluster members <add | remove> <player>")
684
+ TagResolver.resolver(
685
+ "value",
686
+ Tag.inserting(Component.text("/plot cluster members <add | remove> <player>"))
687
+ )
626
688
  );
627
689
  return false;
628
690
  }
@@ -643,7 +705,7 @@ public class Cluster extends SubCommand {
643
705
  } else if (throwable != null) {
644
706
  player.sendMessage(
645
707
  TranslatableCaption.of("errors.invalid_player"),
646
- Template.of("value", args[2])
708
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[2])))
647
709
  );
648
710
  } else {
649
711
  if (args[1].equalsIgnoreCase("add")) {
@@ -657,7 +719,9 @@ public class Cluster extends SubCommand {
657
719
  } else {
658
720
  player.sendMessage(
659
721
  TranslatableCaption.of("commandconfig.command_syntax"),
660
- Template.of("value", "/plot cluster members <add | remove> <player>")
722
+ TagResolver.resolver("value", Tag.inserting(Component.text(
723
+ "/plot cluster members <add | remove> <player>"
724
+ )))
661
725
  );
662
726
  }
663
727
  }
@@ -670,14 +734,17 @@ public class Cluster extends SubCommand {
670
734
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_TP)) {
671
735
  player.sendMessage(
672
736
  TranslatableCaption.of("permission.no_permission"),
673
- Template.of("node", Permission.PERMISSION_CLUSTER_TP.toString())
737
+ TagResolver.resolver(
738
+ "node",
739
+ Tag.inserting(Permission.PERMISSION_CLUSTER_TP)
740
+ )
674
741
  );
675
742
  return false;
676
743
  }
677
744
  if (args.length != 2) {
678
745
  player.sendMessage(
679
746
  TranslatableCaption.of("commandconfig.command_syntax"),
680
- Template.of("value", "/plot cluster tp <name>")
747
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster tp <name>")))
681
748
  );
682
749
  return false;
683
750
  }
@@ -690,7 +757,7 @@ public class Cluster extends SubCommand {
690
757
  if (cluster == null) {
691
758
  player.sendMessage(
692
759
  TranslatableCaption.of("cluster.invalid_cluster_name"),
693
- Template.of("cluster", args[1])
760
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(args[1])))
694
761
  );
695
762
  return false;
696
763
  }
@@ -699,7 +766,10 @@ public class Cluster extends SubCommand {
699
766
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_TP_OTHER)) {
700
767
  player.sendMessage(
701
768
  TranslatableCaption.of("permission.no_permission"),
702
- Template.of("node", Permission.PERMISSION_CLUSTER_TP_OTHER.toString())
769
+ TagResolver.resolver(
770
+ "node",
771
+ Tag.inserting(Permission.PERMISSION_CLUSTER_TP_OTHER)
772
+ )
703
773
  );
704
774
  return false;
705
775
  }
@@ -715,14 +785,17 @@ public class Cluster extends SubCommand {
715
785
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INFO)) {
716
786
  player.sendMessage(
717
787
  TranslatableCaption.of("permission.no_permission"),
718
- Template.of("node", Permission.PERMISSION_CLUSTER_TP.toString())
788
+ TagResolver.resolver(
789
+ "node",
790
+ Tag.inserting(Permission.PERMISSION_CLUSTER_TP)
791
+ )
719
792
  );
720
793
  return false;
721
794
  }
722
795
  if (args.length != 1 && args.length != 2) {
723
796
  player.sendMessage(
724
797
  TranslatableCaption.of("commandconfig.command_syntax"),
725
- Template.of("value", "/plot cluster info [name]")
798
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster info [name]")))
726
799
  );
727
800
  }
728
801
  PlotArea area = player.getApplicablePlotArea();
@@ -736,7 +809,7 @@ public class Cluster extends SubCommand {
736
809
  if (cluster == null) {
737
810
  player.sendMessage(
738
811
  TranslatableCaption.of("cluster.invalid_cluster_name"),
739
- Template.of("cluster", args[1])
812
+ TagResolver.resolver("cluster", Tag.inserting(Component.text(args[1])))
740
813
  );
741
814
  return false;
742
815
  }
@@ -765,19 +838,14 @@ public class Cluster extends SubCommand {
765
838
  cluster.getP2().getY() - cluster.getP1().getY() + 1);
766
839
  String rights = cluster.isAdded(player.getUUID()) + "";
767
840
  Caption message = TranslatableCaption.of("cluster.cluster_info");
768
- Template idTemplate = Template.of("id", id);
769
- Template ownerTemplate = Template.of("owner", owner);
770
- Template nameTemplate = Template.of("name", name);
771
- Template sizeTemplate = Template.of("size", size);
772
- Template rightsTemplate = Template.of("rights", rights);
773
- player.sendMessage(
774
- message,
775
- idTemplate,
776
- ownerTemplate,
777
- nameTemplate,
778
- sizeTemplate,
779
- rightsTemplate
780
- );
841
+ TagResolver resolver = TagResolver.builder()
842
+ .tag("id", Tag.inserting(Component.text(id)))
843
+ .tag("owner", Tag.inserting(Component.text(owner)))
844
+ .tag("name", Tag.inserting(Component.text(name)))
845
+ .tag("size", Tag.inserting(Component.text(size)))
846
+ .tag("rights", Tag.inserting(Component.text(rights)))
847
+ .build();
848
+ player.sendMessage(message, resolver);
781
849
  }
782
850
  });
783
851
  return true;
@@ -788,14 +856,14 @@ public class Cluster extends SubCommand {
788
856
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_SETHOME)) {
789
857
  player.sendMessage(
790
858
  TranslatableCaption.of("permission.no_permission"),
791
- Template.of("node", Permission.PERMISSION_CLUSTER_SETHOME.toString())
859
+ TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_CLUSTER_SETHOME))
792
860
  );
793
861
  return false;
794
862
  }
795
863
  if (args.length != 1 && args.length != 2) {
796
864
  player.sendMessage(
797
865
  TranslatableCaption.of("commandconfig.command_syntax"),
798
- Template.of("value", "/plot cluster sethome")
866
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster sethome")))
799
867
  );
800
868
  return false;
801
869
  }
@@ -812,7 +880,10 @@ public class Cluster extends SubCommand {
812
880
  if (!player.hasPermission(Permission.PERMISSION_CLUSTER_SETHOME_OTHER)) {
813
881
  player.sendMessage(
814
882
  TranslatableCaption.of("permission.no_permission"),
815
- Template.of("node", Permission.PERMISSION_CLUSTER_SETHOME_OTHER.toString())
883
+ TagResolver.resolver(
884
+ "node",
885
+ Tag.inserting(Permission.PERMISSION_CLUSTER_SETHOME_OTHER)
886
+ )
816
887
  );
817
888
  return false;
818
889
  }
@@ -831,10 +902,7 @@ public class Cluster extends SubCommand {
831
902
  }
832
903
  player.sendMessage(
833
904
  TranslatableCaption.of("cluster.cluster_available_args"),
834
- Template.of(
835
- "list",
836
- "<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>"
837
- )
905
+ TagResolver.resolver("list", Tag.inserting(ComponentHelper.join(AVAILABLE_ARGS, SEPARATOR)))
838
906
  );
839
907
  return false;
840
908
  }
Core/src/main/java/com/plotsquared/core/command/CmdConfirm.java CHANGED
@@ -25,7 +25,9 @@ import com.plotsquared.core.player.PlayerMetaDataKeys;
25
25
  import com.plotsquared.core.player.PlotPlayer;
26
26
  import com.plotsquared.core.util.task.TaskManager;
27
27
  import com.plotsquared.core.util.task.TaskTime;
28
- import net.kyori.adventure.text.minimessage.Template;
28
+ import net.kyori.adventure.text.Component;
29
+ import net.kyori.adventure.text.minimessage.tag.Tag;
30
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
29
31
  import org.checkerframework.checker.nullness.qual.Nullable;
30
32
 
31
33
  public class CmdConfirm {
@@ -52,9 +54,11 @@ public class CmdConfirm {
52
54
  if (commandStr != null) {
53
55
  player.sendMessage(
54
56
  TranslatableCaption.of("confirm.requires_confirm"),
55
- Template.of("command", commandStr),
56
- Template.of("timeout", String.valueOf(Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS)),
57
- Template.of("value", "/plot confirm")
57
+ TagResolver.builder()
58
+ .tag("command", Tag.inserting(Component.text(commandStr)))
59
+ .tag("timeout", Tag.inserting(Component.text(Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS)))
60
+ .tag("value", Tag.inserting(Component.text("/plot confirm")))
61
+ .build()
58
62
  );
59
63
  }
60
64
  TaskManager.runTaskLater(() -> {
Core/src/main/java/com/plotsquared/core/command/Command.java CHANGED
@@ -29,8 +29,10 @@ import com.plotsquared.core.util.StringComparison;
29
29
  import com.plotsquared.core.util.StringMan;
30
30
  import com.plotsquared.core.util.task.RunnableVal2;
31
31
  import com.plotsquared.core.util.task.RunnableVal3;
32
+ import net.kyori.adventure.text.Component;
32
33
  import net.kyori.adventure.text.minimessage.MiniMessage;
33
- import net.kyori.adventure.text.minimessage.Template;
34
+ import net.kyori.adventure.text.minimessage.tag.Tag;
35
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
34
36
  import org.checkerframework.checker.nullness.qual.Nullable;
35
37
 
36
38
  import java.lang.reflect.InvocationTargetException;
@@ -255,10 +257,14 @@ public abstract class Command {
255
257
  max = c.size();
256
258
  }
257
259
  // Send the header
258
- Template curTemplate = Template.of("cur", String.valueOf(page + 1));
259
- Template maxTemplate = Template.of("max", String.valueOf(totalPages + 1));
260
- Template amountTemplate = Template.of("amount", String.valueOf(c.size()));
261
- player.sendMessage(header, curTemplate, maxTemplate, amountTemplate);
260
+ player.sendMessage(
261
+ header,
262
+ TagResolver.builder()
263
+ .tag("cur", Tag.inserting(Component.text(page + 1)))
264
+ .tag("max", Tag.inserting(Component.text(totalPages + 1)))
265
+ .tag("amount", Tag.inserting(Component.text(c.size())))
266
+ .build()
267
+ );
262
268
  // Send the page content
263
269
  List<T> subList = c.subList(page * size, max);
264
270
  int i = page * size;
@@ -266,13 +272,24 @@ public abstract class Command {
266
272
  i++;
267
273
  final CaptionHolder msg = new CaptionHolder();
268
274
  add.run(i, obj, msg);
269
- player.sendMessage(msg.get(), msg.getTemplates());
275
+ player.sendMessage(msg.get(), msg.getTagResolvers());
270
276
  }
271
277
  // Send the footer
272
- Template command1 = Template.of("command1", baseCommand + " " + page);
273
- Template command2 = Template.of("command2", baseCommand + " " + (page + 2));
274
- Template clickable = Template.of("clickable", TranslatableCaption.of("list.clickable").getComponent(player));
275
- player.sendMessage(TranslatableCaption.of("list.page_turn"), command1, command2, clickable);
278
+ player.sendMessage(
279
+ TranslatableCaption.of("list.page_turn"),
280
+ TagResolver.builder()
281
+ .tag("cur", Tag.inserting(Component.text(page + 1)))
282
+ .tag(
283
+ "command1",
284
+ Tag.preProcessParsed(baseCommand + " " + page)
285
+ )
286
+ .tag("command2", Tag.preProcessParsed(baseCommand + " " + (page + 2)))
287
+ .tag(
288
+ "clickable",
289
+ Tag.inserting(TranslatableCaption.of("list.clickable").toComponent(player))
290
+ )
291
+ .build()
292
+ );
276
293
  }
277
294
 
278
295
  /**
@@ -324,7 +341,7 @@ public abstract class Command {
324
341
  if (commands.isEmpty()) {
325
342
  player.sendMessage(
326
343
  TranslatableCaption.of("commandconfig.did_you_mean"),
327
- Template.of("value", MainCommand.getInstance().help.getUsage())
344
+ TagResolver.resolver("value", Tag.inserting(Component.text(MainCommand.getInstance().help.getUsage())))
328
345
  );
329
346
  return CompletableFuture.completedFuture(false);
330
347
  }
@@ -345,7 +362,7 @@ public abstract class Command {
345
362
  }
346
363
  player.sendMessage(
347
364
  TranslatableCaption.of("commandconfig.did_you_mean"),
348
- Template.of("value", cmd.getUsage())
365
+ TagResolver.resolver("value", Tag.inserting(Component.text(cmd.getUsage())))
349
366
  );
350
367
  return CompletableFuture.completedFuture(false);
351
368
  }
@@ -380,7 +397,7 @@ public abstract class Command {
380
397
  // TODO improve or remove the Argument system
381
398
  player.sendMessage(
382
399
  TranslatableCaption.of("commandconfig.command_syntax"),
383
- Template.of("value", StringMan.join(fullSplit, " "))
400
+ TagResolver.resolver("value", Tag.inserting(Component.text(StringMan.join(fullSplit, " "))))
384
401
  );
385
402
  return false;
386
403
  }
@@ -469,7 +486,7 @@ public abstract class Command {
469
486
  if (message) {
470
487
  player.sendMessage(
471
488
  TranslatableCaption.of("permission.no_permission"),
472
- Template.of("node", getPermission())
489
+ TagResolver.resolver("node", Tag.inserting(Component.text(getPermission())))
473
490
  );
474
491
  }
475
492
  } else {
@@ -494,7 +511,7 @@ public abstract class Command {
494
511
  public void sendUsage(PlotPlayer<?> player) {
495
512
  player.sendMessage(
496
513
  TranslatableCaption.of("commandconfig.command_syntax"),
497
- Template.of("value", getUsage())
514
+ TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
498
515
  );
499
516
  }
500
517
 
@@ -598,13 +615,13 @@ public abstract class Command {
598
615
  return this.getFullId().hashCode();
599
616
  }
600
617
 
601
- public void checkTrue(boolean mustBeTrue, Caption message, Template... args) {
618
+ public void checkTrue(boolean mustBeTrue, Caption message, TagResolver... args) {
602
619
  if (!mustBeTrue) {
603
620
  throw new CommandException(message, args);
604
621
  }
605
622
  }
606
623
 
607
- public <T> T check(T object, Caption message, Template... args) {
624
+ public <T> T check(T object, Caption message, TagResolver... args) {
608
625
  if (object == null) {
609
626
  throw new CommandException(message, args);
610
627
  }
@@ -620,10 +637,10 @@ public abstract class Command {
620
637
 
621
638
  public static class CommandException extends RuntimeException {
622
639
 
623
- private final Template[] args;
624
640
  private final Caption message;
641
+ private final TagResolver[] args;
625
642
 
626
- public CommandException(final @Nullable Caption message, final Template... args) {
643
+ public CommandException(final @Nullable Caption message, final TagResolver... args) {
627
644
  this.message = message;
628
645
  this.args = args;
629
646
  }
Core/src/main/java/com/plotsquared/core/command/CommandCaller.java CHANGED
@@ -19,7 +19,7 @@
19
19
  package com.plotsquared.core.command;
20
20
 
21
21
  import com.plotsquared.core.configuration.caption.Caption;
22
- import net.kyori.adventure.text.minimessage.Template;
22
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
23
23
  import org.checkerframework.checker.nullness.qual.NonNull;
24
24
 
25
25
  /**
@@ -34,7 +34,7 @@ public interface CommandCaller {
34
34
  * @param caption Caption to send
35
35
  * @param replacements Variable replacements
36
36
  */
37
- void sendMessage(@NonNull Caption caption, @NonNull Template... replacements);
37
+ void sendMessage(@NonNull Caption caption, @NonNull TagResolver... replacements);
38
38
 
39
39
  /**
40
40
  * Check the player's permissions. <i>Will be cached if permission caching is enabled.</i>
Core/src/main/java/com/plotsquared/core/command/CommandCategory.java CHANGED
@@ -22,6 +22,8 @@ import com.plotsquared.core.configuration.caption.Caption;
22
22
  import com.plotsquared.core.configuration.caption.LocaleHolder;
23
23
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
24
24
  import com.plotsquared.core.player.PlotPlayer;
25
+ import net.kyori.adventure.text.Component;
26
+ import net.kyori.adventure.text.minimessage.MiniMessage;
25
27
  import org.checkerframework.checker.nullness.qual.NonNull;
26
28
 
27
29
  /**
@@ -90,6 +92,11 @@ public enum CommandCategory implements Caption {
90
92
  return this.caption.getComponent(localeHolder);
91
93
  }
92
94
 
95
+ @Override
96
+ public @NonNull Component toComponent(@NonNull final LocaleHolder localeHolder) {
97
+ return MiniMessage.miniMessage().deserialize(getComponent(localeHolder));
98
+ }
99
+
93
100
  /**
94
101
  * Checks if a player has access to this command category
95
102
  *
Core/src/main/java/com/plotsquared/core/command/Comment.java CHANGED
@@ -27,7 +27,9 @@ import com.plotsquared.core.plot.comment.CommentInbox;
27
27
  import com.plotsquared.core.plot.comment.CommentManager;
28
28
  import com.plotsquared.core.plot.comment.PlotComment;
29
29
  import com.plotsquared.core.util.StringMan;
30
- import net.kyori.adventure.text.minimessage.Template;
30
+ import net.kyori.adventure.text.Component;
31
+ import net.kyori.adventure.text.minimessage.tag.Tag;
32
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
31
33
 
32
34
  import java.util.Arrays;
33
35
  import java.util.Locale;
@@ -44,8 +46,10 @@ public class Comment extends SubCommand {
44
46
  if (args.length < 2) {
45
47
  player.sendMessage(
46
48
  TranslatableCaption.of("comment.comment_syntax"),
47
- Template.of("command", "/plot comment [X;Z]"),
48
- Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
49
+ TagResolver.builder()
50
+ .tag("command", Tag.inserting(Component.text("/plot comment [X;Z]")))
51
+ .tag("list", Tag.inserting(Component.text(StringMan.join(CommentManager.inboxes.keySet(), "|"))))
52
+ .build()
49
53
  );
50
54
  return false;
51
55
  }
@@ -64,8 +68,10 @@ public class Comment extends SubCommand {
64
68
  if (args.length < 3) {
65
69
  player.sendMessage(
66
70
  TranslatableCaption.of("comment.comment_syntax"),
67
- Template.of("command", "/plot comment [X;Z]"),
68
- Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
71
+ TagResolver.builder()
72
+ .tag("command", Tag.inserting(Component.text("/plot comment [X;Z]")))
73
+ .tag("list", Tag.inserting(Component.text(StringMan.join(CommentManager.inboxes.keySet(), "|"))))
74
+ .build()
69
75
  );
70
76
  return false;
71
77
  }
@@ -76,8 +82,10 @@ public class Comment extends SubCommand {
76
82
  if (inbox == null) {
77
83
  player.sendMessage(
78
84
  TranslatableCaption.of("comment.comment_syntax"),
79
- Template.of("command", "/plot comment [X;Z]"),
80
- Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
85
+ TagResolver.builder()
86
+ .tag("command", Tag.inserting(Component.text("/plot comment [X;Z]")))
87
+ .tag("list", Tag.inserting(Component.text(StringMan.join(CommentManager.inboxes.keySet(), "|"))))
88
+ .build()
81
89
  );
82
90
  return false;
83
91
  }
@@ -97,8 +105,10 @@ public class Comment extends SubCommand {
97
105
  player.sendMessage(TranslatableCaption.of("comment.no_plot_inbox"));
98
106
  player.sendMessage(
99
107
  TranslatableCaption.of("comment.comment_syntax"),
100
- Template.of("command", "/plot comment [X;Z]"),
101
- Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
108
+ TagResolver.builder()
109
+ .tag("command", Tag.inserting(Component.text("/plot comment [X;Z]")))
110
+ .tag("list", Tag.inserting(Component.text(StringMan.join(CommentManager.inboxes.keySet(), "|"))))
111
+ .build()
102
112
  );
103
113
  return false;
104
114
  }
Core/src/main/java/com/plotsquared/core/command/Condense.java CHANGED
@@ -29,7 +29,9 @@ import com.plotsquared.core.util.MathMan;
29
29
  import com.plotsquared.core.util.WorldUtil;
30
30
  import com.plotsquared.core.util.task.TaskManager;
31
31
  import com.plotsquared.core.util.task.TaskTime;
32
- import net.kyori.adventure.text.minimessage.Template;
32
+ import net.kyori.adventure.text.Component;
33
+ import net.kyori.adventure.text.minimessage.tag.Tag;
34
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
33
35
  import org.checkerframework.checker.nullness.qual.NonNull;
34
36
 
35
37
  import java.util.ArrayList;
@@ -68,7 +70,9 @@ public class Condense extends SubCommand {
68
70
  if (args.length != 2 && args.length != 3) {
69
71
  player.sendMessage(
70
72
  TranslatableCaption.of("commandconfig.command_syntax"),
71
- Template.of("value", "/plot condense <area> <start | stop | info> [radius]")
73
+ TagResolver.resolver("value", Tag.inserting(Component.text(
74
+ "/plot condense <area> <start | stop | info> [radius]"
75
+ )))
72
76
  );
73
77
  return false;
74
78
  }
@@ -82,7 +86,10 @@ public class Condense extends SubCommand {
82
86
  if (args.length == 2) {
83
87
  player.sendMessage(
84
88
  TranslatableCaption.of("commandconfig.command_syntax"),
85
- Template.of("value", "/plot condense" + area + " start <radius>")
89
+ TagResolver.resolver(
90
+ "value",
91
+ Tag.inserting(Component.text("/plot condense" + area + " start " + "<radius>"))
92
+ )
86
93
  );
87
94
  return false;
88
95
  }
@@ -181,8 +188,10 @@ public class Condense extends SubCommand {
181
188
  if (result.get()) {
182
189
  player.sendMessage(
183
190
  TranslatableCaption.of("condense.moving"),
184
- Template.of("origin", String.valueOf(origin)),
185
- Template.of("possible", String.valueOf(possible))
191
+ TagResolver.builder()
192
+ .tag("origin", Tag.inserting(Component.text(origin.toString())))
193
+ .tag("possible", Tag.inserting(Component.text(possible.toString())))
194
+ .build()
186
195
  );
187
196
  TaskManager.runTaskLater(task, TaskTime.ticks(1L));
188
197
  }
@@ -202,7 +211,7 @@ public class Condense extends SubCommand {
202
211
  if (i >= free.size()) {
203
212
  player.sendMessage(
204
213
  TranslatableCaption.of("condense.skipping"),
205
- Template.of("plot", String.valueOf(origin))
214
+ TagResolver.resolver("plot", Tag.inserting(Component.text(origin.toString())))
206
215
  );
207
216
  }
208
217
  }
@@ -223,7 +232,10 @@ public class Condense extends SubCommand {
223
232
  if (args.length == 2) {
224
233
  player.sendMessage(
225
234
  TranslatableCaption.of("commandconfig.command_syntax"),
226
- Template.of("value", "/plot condense " + area + " info <radius>")
235
+ TagResolver.resolver(
236
+ "value",
237
+ Tag.inserting(Component.text("/plot condense " + area + " info <radius>"))
238
+ )
227
239
  );
228
240
  return false;
229
241
  }
@@ -244,20 +256,20 @@ public class Condense extends SubCommand {
244
256
  player.sendMessage(TranslatableCaption.of("condense.default_eval"));
245
257
  player.sendMessage(
246
258
  TranslatableCaption.of("condense.minimum_radius"),
247
- Template.of("minimumRadius", String.valueOf(minimumRadius))
259
+ TagResolver.resolver("minimumRadius", Tag.inserting(Component.text(minimumRadius)))
248
260
  );
249
261
  player.sendMessage(
250
- TranslatableCaption.of("condense.minimum_radius"),
251
- Template.of("maxMove", String.valueOf(maxMove))
262
+ TranslatableCaption.of("condense.maximum_moved"),
263
+ TagResolver.resolver("maxMove", Tag.inserting(Component.text(maxMove)))
252
264
  );
253
265
  player.sendMessage(TranslatableCaption.of("condense.input_eval"));
254
266
  player.sendMessage(
255
267
  TranslatableCaption.of("condense.input_radius"),
256
- Template.of("radius", String.valueOf(radius))
268
+ TagResolver.resolver("radius", Tag.inserting(Component.text(radius)))
257
269
  );
258
270
  player.sendMessage(
259
271
  TranslatableCaption.of("condense.estimated_moves"),
260
- Template.of("userMove", String.valueOf(userMove))
272
+ TagResolver.resolver("userMove", Tag.inserting(Component.text(userMove)))
261
273
  );
262
274
  player.sendMessage(TranslatableCaption.of("condense.eta"));
263
275
  player.sendMessage(TranslatableCaption.of("condense.radius_measured"));
@@ -266,7 +278,10 @@ public class Condense extends SubCommand {
266
278
  }
267
279
  player.sendMessage(
268
280
  TranslatableCaption.of("commandconfig.command_syntax"),
269
- Template.of("value", "/plot condense " + area.getWorldName() + " <start | stop | info> [radius]")
281
+ TagResolver.resolver(
282
+ "value",
283
+ Tag.inserting(Component.text("/plot condense " + area.getWorldName() + " <start | stop | info> [radius]"))
284
+ )
270
285
  );
271
286
  return false;
272
287
  }
Core/src/main/java/com/plotsquared/core/command/Continue.java CHANGED
@@ -29,7 +29,9 @@ import com.plotsquared.core.plot.Plot;
29
29
  import com.plotsquared.core.plot.flag.PlotFlag;
30
30
  import com.plotsquared.core.plot.flag.implementations.DoneFlag;
31
31
  import com.plotsquared.core.util.EventDispatcher;
32
- import net.kyori.adventure.text.minimessage.Template;
32
+ import net.kyori.adventure.text.Component;
33
+ import net.kyori.adventure.text.minimessage.tag.Tag;
34
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
33
35
  import org.checkerframework.checker.nullness.qual.NonNull;
34
36
 
35
37
  @CommandDeclaration(command = "continue",
@@ -55,7 +57,9 @@ public class Continue extends SubCommand {
55
57
  if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
56
58
  player.sendMessage(
57
59
  TranslatableCaption.of("permission.no_permission"),
58
- Template.of("node", TranslatableCaption.of("permission.no_plot_perms").getComponent(player))
60
+ TagResolver.resolver("node", Tag.inserting(
61
+ TranslatableCaption.of("permission.no_plot_perms").toComponent(player)
62
+ ))
59
63
  );
60
64
  return false;
61
65
  }
@@ -68,7 +72,7 @@ public class Continue extends SubCommand {
68
72
  < player.getPlotCount() + size)) {
69
73
  player.sendMessage(
70
74
  TranslatableCaption.of("permission.cant_claim_more_plots"),
71
- Template.of("amount", String.valueOf(player.getAllowedPlots()))
75
+ TagResolver.resolver("amount", Tag.inserting(Component.text(player.getAllowedPlots())))
72
76
  );
73
77
  return false;
74
78
  }
@@ -82,7 +86,7 @@ public class Continue extends SubCommand {
82
86
  if (event.getEventResult() == Result.DENY) {
83
87
  player.sendMessage(
84
88
  TranslatableCaption.of("events.event_denied"),
85
- Template.of("value", "Done flag removal")
89
+ TagResolver.resolver("value", Tag.inserting(Component.text("Done flag removal")))
86
90
  );
87
91
  return true;
88
92
  }
Core/src/main/java/com/plotsquared/core/command/Copy.java CHANGED
@@ -23,7 +23,9 @@ import com.plotsquared.core.location.Location;
23
23
  import com.plotsquared.core.permissions.Permission;
24
24
  import com.plotsquared.core.player.PlotPlayer;
25
25
  import com.plotsquared.core.plot.Plot;
26
- import net.kyori.adventure.text.minimessage.Template;
26
+ import net.kyori.adventure.text.Component;
27
+ import net.kyori.adventure.text.minimessage.tag.Tag;
28
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
27
29
 
28
30
  @CommandDeclaration(command = "copy",
29
31
  permission = "plots.copy",
@@ -48,7 +50,7 @@ public class Copy extends SubCommand {
48
50
  if (args.length != 1) {
49
51
  player.sendMessage(
50
52
  TranslatableCaption.of("commandconfig.command_syntax"),
51
- Template.of("value", "/plot copy <X;Z>")
53
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot copy <X;Z>")))
52
54
  );
53
55
  return false;
54
56
  }
@@ -67,8 +69,11 @@ public class Copy extends SubCommand {
67
69
 
68
70
  plot1.getPlotModificationManager().copy(plot2, player).thenAccept(result -> {
69
71
  if (result) {
70
- player.sendMessage(TranslatableCaption.of("move.copy_success"), Template.of("origin", String.valueOf(plot1)),
71
- Template.of("target", String.valueOf(plot2))
72
+ player.sendMessage(TranslatableCaption.of("move.copy_success"),
73
+ TagResolver.builder()
74
+ .tag("origin", Tag.inserting(Component.text(plot1.toString())))
75
+ .tag("target", Tag.inserting(Component.text(plot2.toString())))
76
+ .build()
72
77
  );
73
78
  } else {
74
79
  player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
Core/src/main/java/com/plotsquared/core/command/CreateRoadSchematic.java CHANGED
@@ -25,7 +25,9 @@ import com.plotsquared.core.generator.HybridUtils;
25
25
  import com.plotsquared.core.location.Location;
26
26
  import com.plotsquared.core.player.PlotPlayer;
27
27
  import com.plotsquared.core.plot.Plot;
28
- import net.kyori.adventure.text.minimessage.Template;
28
+ import net.kyori.adventure.text.Component;
29
+ import net.kyori.adventure.text.minimessage.tag.Tag;
30
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
29
31
  import org.checkerframework.checker.nullness.qual.NonNull;
30
32
 
31
33
  @CommandDeclaration(command = "createroadschematic",
@@ -61,7 +63,7 @@ public class CreateRoadSchematic extends SubCommand {
61
63
  this.hybridUtils.setupRoadSchematic(plot);
62
64
  player.sendMessage(
63
65
  TranslatableCaption.of("schematics.schematic_road_created"),
64
- Template.of("command", "/plot debugroadregen")
66
+ TagResolver.resolver("command", Tag.inserting(Component.text("/plot debugroadregen")))
65
67
  );
66
68
  return true;
67
69
  }
Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java CHANGED
@@ -40,7 +40,9 @@ import com.plotsquared.core.util.EventDispatcher;
40
40
  import com.plotsquared.core.util.FileUtils;
41
41
  import com.plotsquared.core.util.query.PlotQuery;
42
42
  import com.plotsquared.core.util.task.TaskManager;
43
- import net.kyori.adventure.text.minimessage.Template;
43
+ import net.kyori.adventure.text.Component;
44
+ import net.kyori.adventure.text.minimessage.tag.Tag;
45
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
44
46
  import org.checkerframework.checker.nullness.qual.NonNull;
45
47
 
46
48
  import java.io.File;
@@ -101,7 +103,10 @@ public class DatabaseCommand extends SubCommand {
101
103
  if (args.length < 1) {
102
104
  player.sendMessage(
103
105
  TranslatableCaption.of("commandconfig.command_syntax"),
104
- Template.of("value", "/plot database [area] <sqlite | mysql | import>")
106
+ TagResolver.resolver(
107
+ "value",
108
+ Tag.inserting(Component.text("/plot database [area] <sqlite | mysql | import>"))
109
+ )
105
110
  );
106
111
  return false;
107
112
  }
@@ -116,7 +121,7 @@ public class DatabaseCommand extends SubCommand {
116
121
  if (args.length < 1) {
117
122
  player.sendMessage(
118
123
  TranslatableCaption.of("commandconfig.command_syntax"),
119
- Template.of("value", "/plot database [area] <sqlite|mysql|import>")
124
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot database [area] <sqlite|mysql|import>")))
120
125
  );
121
126
  player.sendMessage(TranslatableCaption.of("database.arg"));
122
127
  return false;
@@ -129,7 +134,10 @@ public class DatabaseCommand extends SubCommand {
129
134
  if (args.length < 2) {
130
135
  player.sendMessage(
131
136
  TranslatableCaption.of("commandconfig.command_syntax"),
132
- Template.of("value", "/plot database import <sqlite file> [prefix]")
137
+ TagResolver.resolver(
138
+ "value",
139
+ Tag.inserting(Component.text("/plot database import <sqlite file> [prefix]"))
140
+ )
133
141
  );
134
142
  return false;
135
143
  }
@@ -140,7 +148,7 @@ public class DatabaseCommand extends SubCommand {
140
148
  if (!file.exists()) {
141
149
  player.sendMessage(
142
150
  TranslatableCaption.of("database.does_not_exist"),
143
- Template.of("value", String.valueOf(file))
151
+ TagResolver.resolver("value", Tag.inserting(Component.text(file.toString())))
144
152
  );
145
153
  return false;
146
154
  }
@@ -184,8 +192,10 @@ public class DatabaseCommand extends SubCommand {
184
192
  }
185
193
  player.sendMessage(
186
194
  TranslatableCaption.of("database.skipping_duplicated_plot"),
187
- Template.of("plot", String.valueOf(plot)),
188
- Template.of("id", String.valueOf(plot.temp))
195
+ TagResolver.builder()
196
+ .tag("plot", Tag.inserting(Component.text(plot.toString())))
197
+ .tag("id", Tag.inserting(Component.text(plot.temp)))
198
+ .build()
189
199
  );
190
200
  continue;
191
201
  }
Core/src/main/java/com/plotsquared/core/command/Debug.java CHANGED
@@ -34,7 +34,8 @@ import com.plotsquared.core.uuid.UUIDMapping;
34
34
  import com.sk89q.worldedit.world.entity.EntityType;
35
35
  import net.kyori.adventure.text.Component;
36
36
  import net.kyori.adventure.text.TextComponent;
37
- import net.kyori.adventure.text.minimessage.Template;
37
+ import net.kyori.adventure.text.minimessage.tag.Tag;
38
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
38
39
  import org.checkerframework.checker.nullness.qual.NonNull;
39
40
 
40
41
  import java.util.Collection;
@@ -68,7 +69,10 @@ public class Debug extends SubCommand {
68
69
  if (args.length == 0) {
69
70
  player.sendMessage(
70
71
  TranslatableCaption.of("commandconfig.command_syntax"),
71
- Template.of("value", "/plot debug <loadedchunks | player | debug-players | entitytypes | msg>")
72
+ TagResolver.resolver(
73
+ "value",
74
+ Tag.inserting(Component.text("/plot debug <loadedchunks | player | debug-players | entitytypes | msg>"))
75
+ )
72
76
  );
73
77
  }
74
78
  if (args.length > 0) {
@@ -95,7 +99,7 @@ public class Debug extends SubCommand {
95
99
  final Collection<UUIDMapping> mappings = PlotSquared.get().getImpromptuUUIDPipeline().getAllImmediately();
96
100
  player.sendMessage(
97
101
  TranslatableCaption.of("debug.cached_uuids"),
98
- Template.of("value", String.valueOf(mappings.size()))
102
+ TagResolver.resolver("value", Tag.inserting(Component.text(mappings.size())))
99
103
  );
100
104
  return true;
101
105
  }
@@ -104,7 +108,7 @@ public class Debug extends SubCommand {
104
108
  for (final PlotPlayer<?> pp : PlotPlayer.getDebugModePlayers()) {
105
109
  player.sendMessage(
106
110
  TranslatableCaption.of("debug.player_in_debugmode_list"),
107
- Template.of("value", pp.getName())
111
+ TagResolver.resolver("value", Tag.inserting(Component.text(pp.getName())))
108
112
  );
109
113
  }
110
114
  return true;
@@ -114,10 +118,11 @@ public class Debug extends SubCommand {
114
118
  player.sendMessage(TranslatableCaption.of("debug.entity_categories"));
115
119
  EntityCategory.REGISTRY.forEach(category -> {
116
120
  final StringBuilder builder =
117
- new StringBuilder("§7- §6").append(category.getId()).append("§7: §6");
121
+ new StringBuilder("<gray>-</gray> <gold>").append(category.getId()).append("</gold><gray>: <gold>");
118
122
  for (final EntityType entityType : category.getAll()) {
119
123
  builder.append(entityType.getId()).append(" ");
120
124
  }
125
+ builder.append("</gold>");
121
126
  player.sendMessage(StaticCaption.of("<prefix>" + builder));
122
127
  });
123
128
  EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId))
@@ -137,28 +142,53 @@ public class Debug extends SubCommand {
137
142
  .getCaptionMap(TranslatableCaption.DEFAULT_NAMESPACE)
138
143
  .getCaptions();
139
144
  TextComponent.Builder information = Component.text();
140
- Component header = MINI_MESSAGE.parse(TranslatableCaption.of("debug.debug_header").getComponent(player) + "\n");
145
+ Component header = TranslatableCaption.of("debug.debug_header").toComponent(player)
146
+ .append(Component.newline());
141
147
  String line = TranslatableCaption.of("debug.debug_line").getComponent(player) + "\n";
142
148
  String section = TranslatableCaption.of("debug.debug_section").getComponent(player) + "\n";
143
149
  information.append(header);
144
- information.append(MINI_MESSAGE.parse(section, Template.of("val", "PlotArea")));
150
+ information.append(MINI_MESSAGE.deserialize(
151
+ section,
152
+ TagResolver.resolver("val", Tag.inserting(Component.text("PlotArea")))
153
+ ));
145
154
  information.append(MINI_MESSAGE
146
- .parse(
155
+ .deserialize(
147
156
  line,
148
- Template.of("var", "Plot Worlds"),
149
- Template.of("val", StringMan.join(this.plotAreaManager.getAllPlotAreas(), ", "))
157
+ TagResolver.builder()
158
+ .tag("var", Tag.inserting(Component.text("Plot Worlds")))
159
+ .tag(
160
+ "val",
161
+ Tag.inserting(Component.text(StringMan.join(
162
+ this.plotAreaManager.getAllPlotAreas(),
163
+ ", "
164
+ )))
165
+ )
166
+ .build()
150
167
  ));
151
168
  information.append(
152
- MINI_MESSAGE.parse(
169
+ MINI_MESSAGE.deserialize(
153
170
  line,
154
- Template.of("var", "Owned Plots"),
155
- Template.of("val", String.valueOf(PlotQuery.newQuery().allPlots().count()))
171
+ TagResolver.builder()
172
+ .tag("var", Tag.inserting(Component.text("Owned Plots")))
173
+ .tag(
174
+ "val",
175
+ Tag.inserting(Component.text(PlotQuery.newQuery().allPlots().count()))
176
+ )
177
+ .build()
156
178
  ));
157
- information.append(MINI_MESSAGE.parse(section, Template.of("val", "Messages")));
158
- information.append(MINI_MESSAGE.parse(
179
+ information.append(MINI_MESSAGE.deserialize(
180
+ section,
181
+ TagResolver.resolver("val", Tag.inserting(Component.text("Messages")))
182
+ ));
183
+ information.append(MINI_MESSAGE.deserialize(
159
184
  line,
160
- Template.of("var", "Total Messages"),
161
- Template.of("val", String.valueOf(captions.size()))
185
+ TagResolver.builder()
186
+ .tag("var", Tag.inserting(Component.text("Total Messages")))
187
+ .tag(
188
+ "val",
189
+ Tag.inserting(Component.text(captions.size()))
190
+ )
191
+ .build()
162
192
  ));
163
193
  player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(information.build())));
164
194
  return true;
Core/src/main/java/com/plotsquared/core/command/DebugExec.java CHANGED
@@ -36,7 +36,9 @@ import com.plotsquared.core.util.EventDispatcher;
36
36
  import com.plotsquared.core.util.StringMan;
37
37
  import com.plotsquared.core.util.query.PlotQuery;
38
38
  import com.plotsquared.core.util.task.RunnableVal;
39
- import net.kyori.adventure.text.minimessage.Template;
39
+ import net.kyori.adventure.text.Component;
40
+ import net.kyori.adventure.text.minimessage.tag.Tag;
41
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
40
42
  import org.checkerframework.checker.nullness.qual.NonNull;
41
43
 
42
44
  import java.util.Arrays;
@@ -95,7 +97,7 @@ public class DebugExec extends SubCommand {
95
97
  if (analysis != null) {
96
98
  player.sendMessage(
97
99
  TranslatableCaption.of("debugexec.changes_column"),
98
- Template.of("value", String.valueOf(analysis.changes))
100
+ TagResolver.resolver("value", Tag.inserting(Component.text(analysis.changes)))
99
101
  );
100
102
  return true;
101
103
  }
@@ -105,7 +107,7 @@ public class DebugExec extends SubCommand {
105
107
  public void run(PlotAnalysis value) {
106
108
  player.sendMessage(
107
109
  TranslatableCaption.of("debugexec.analyze_done"),
108
- Template.of("command", "/plot debugexec analyze")
110
+ TagResolver.resolver("command", Tag.inserting(Component.text("/plot debugexec analyze")))
109
111
  );
110
112
  }
111
113
  });
@@ -115,7 +117,10 @@ public class DebugExec extends SubCommand {
115
117
  if (args.length != 2) {
116
118
  player.sendMessage(
117
119
  TranslatableCaption.of("commandconfig.command_syntax"),
118
- Template.of("value", "/plot debugexec analyze <threshold>")
120
+ TagResolver.resolver(
121
+ "value",
122
+ Tag.inserting(Component.text("/plot debugexec analyze <threshold>"))
123
+ )
119
124
  );
120
125
  player.sendMessage(TranslatableCaption.of("debugexec.threshold_default"));
121
126
  return false;
@@ -126,7 +131,7 @@ public class DebugExec extends SubCommand {
126
131
  } catch (NumberFormatException ignored) {
127
132
  player.sendMessage(
128
133
  TranslatableCaption.of("debugexec.invalid_threshold"),
129
- Template.of("value", args[1])
134
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
130
135
  );
131
136
  player.sendMessage(TranslatableCaption.of("debugexec.threshold_default_double"));
132
137
  return false;
@@ -157,7 +162,7 @@ public class DebugExec extends SubCommand {
157
162
  if (args.length != 2) {
158
163
  player.sendMessage(
159
164
  TranslatableCaption.of("commandconfig.command_syntax"),
160
- Template.of("value", "/plot debugexec remove-flag <flag>")
165
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot debugexec remove-flag <flag>")))
161
166
  );
162
167
  return false;
163
168
  }
@@ -175,7 +180,7 @@ public class DebugExec extends SubCommand {
175
180
  }
176
181
  player.sendMessage(
177
182
  TranslatableCaption.of("debugexec.cleared_flag"),
178
- Template.of("value", flag)
183
+ TagResolver.resolver("value", Tag.inserting(Component.text(flag)))
179
184
  );
180
185
  return true;
181
186
  }
@@ -183,7 +188,10 @@ public class DebugExec extends SubCommand {
183
188
  if (args.length != 2) {
184
189
  player.sendMessage(
185
190
  TranslatableCaption.of("commandconfig.command_syntax"),
186
- Template.of("value", "Invalid syntax: /plot debugexec start-rgar <world>")
191
+ TagResolver.resolver(
192
+ "value",
193
+ Tag.inserting(Component.text("Invalid syntax: /plot debugexec start-rgar <world>"))
194
+ )
187
195
  );
188
196
  return false;
189
197
  }
@@ -191,7 +199,7 @@ public class DebugExec extends SubCommand {
191
199
  if (area == null) {
192
200
  player.sendMessage(
193
201
  TranslatableCaption.of("errors.not_valid_plot_world"),
194
- Template.of("value", args[1])
202
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
195
203
  );
196
204
  return false;
197
205
  }
Core/src/main/java/com/plotsquared/core/command/DebugPaste.java CHANGED
@@ -31,7 +31,9 @@ import com.plotsquared.core.inject.annotations.WorldFile;
31
31
  import com.plotsquared.core.player.PlotPlayer;
32
32
  import com.plotsquared.core.util.PremiumVerification;
33
33
  import com.plotsquared.core.util.task.TaskManager;
34
- import net.kyori.adventure.text.minimessage.Template;
34
+ import net.kyori.adventure.text.Component;
35
+ import net.kyori.adventure.text.minimessage.tag.Tag;
36
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
35
37
  import org.checkerframework.checker.nullness.qual.NonNull;
36
38
 
37
39
  import java.io.File;
@@ -131,8 +133,10 @@ public class DebugPaste extends SubCommand {
131
133
  } catch (IOException ignored) {
132
134
  player.sendMessage(
133
135
  TranslatableCaption.of("debugpaste.latest_log"),
134
- Template.of("file", "latest.log"),
135
- Template.of("size", "14MB")
136
+ TagResolver.builder()
137
+ .tag("file", Tag.inserting(Component.text("latest.log")))
138
+ .tag("size", Tag.inserting(Component.text("14MB")))
139
+ .build()
136
140
  );
137
141
  }
138
142
 
@@ -141,7 +145,7 @@ public class DebugPaste extends SubCommand {
141
145
  } catch (final IllegalArgumentException ignored) {
142
146
  player.sendMessage(
143
147
  TranslatableCaption.of("debugpaste.empty_file"),
144
- Template.of("file", "settings.yml")
148
+ TagResolver.resolver("file", Tag.inserting(Component.text("settings.yml")))
145
149
  );
146
150
  }
147
151
  try {
@@ -149,7 +153,7 @@ public class DebugPaste extends SubCommand {
149
153
  } catch (final IllegalArgumentException ignored) {
150
154
  player.sendMessage(
151
155
  TranslatableCaption.of("debugpaste.empty_file"),
152
- Template.of("file", "worlds.yml")
156
+ TagResolver.resolver("file", Tag.inserting(Component.text("worlds.yml")))
153
157
  );
154
158
  }
155
159
 
@@ -162,7 +166,7 @@ public class DebugPaste extends SubCommand {
162
166
  } catch (final IOException ignored) {
163
167
  player.sendMessage(
164
168
  TranslatableCaption.of("debugpaste.skip_multiverse"),
165
- Template.of("file", "worlds.yml")
169
+ TagResolver.resolver("file", Tag.inserting(Component.text("worlds.yml")))
166
170
  );
167
171
  }
168
172
 
@@ -177,20 +181,20 @@ public class DebugPaste extends SubCommand {
177
181
  String.format("https://athion.net/ISPaster/paste/view/%s", pasteId);
178
182
  player.sendMessage(
179
183
  TranslatableCaption.of("debugpaste.debug_report_created"),
180
- Template.of("url", link)
184
+ TagResolver.resolver("url", Tag.preProcessParsed(link))
181
185
  );
182
186
  } else {
183
187
  final String responseMessage = jsonObject.get("response").getAsString();
184
188
  player.sendMessage(
185
189
  TranslatableCaption.of("debugpaste.creation_failed"),
186
- Template.of("value", responseMessage)
190
+ TagResolver.resolver("value", Tag.inserting(Component.text(responseMessage)))
187
191
  );
188
192
  }
189
193
  } catch (final Throwable throwable) {
190
194
  throwable.printStackTrace();
191
195
  player.sendMessage(
192
196
  TranslatableCaption.of("debugpaste.creation_failed"),
193
- Template.of("value", throwable.getMessage())
197
+ TagResolver.resolver("value", Tag.inserting(Component.text(throwable.getMessage())))
194
198
  );
195
199
  }
196
200
  } catch (IOException e) {
Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java CHANGED
@@ -28,7 +28,9 @@ import com.plotsquared.core.plot.Plot;
28
28
  import com.plotsquared.core.plot.PlotArea;
29
29
  import com.plotsquared.core.plot.PlotManager;
30
30
  import com.plotsquared.core.queue.QueueCoordinator;
31
- import net.kyori.adventure.text.minimessage.Template;
31
+ import net.kyori.adventure.text.Component;
32
+ import net.kyori.adventure.text.minimessage.tag.Tag;
33
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
32
34
  import org.checkerframework.checker.nullness.qual.NonNull;
33
35
 
34
36
  import java.util.Arrays;
@@ -60,7 +62,7 @@ public class DebugRoadRegen extends SubCommand {
60
62
  if (args.length < 1) {
61
63
  player.sendMessage(
62
64
  TranslatableCaption.of("commandconfig.command_syntax"),
63
- Template.of("value", DebugRoadRegen.USAGE)
65
+ TagResolver.resolver("value", Tag.inserting(Component.text(DebugRoadRegen.USAGE)))
64
66
  );
65
67
  return false;
66
68
  }
@@ -80,7 +82,7 @@ public class DebugRoadRegen extends SubCommand {
80
82
  default:
81
83
  player.sendMessage(
82
84
  TranslatableCaption.of("commandconfig.command_syntax"),
83
- Template.of("value", DebugRoadRegen.USAGE)
85
+ TagResolver.resolver("value", Tag.inserting(Component.text(DebugRoadRegen.USAGE)))
84
86
  );
85
87
  return false;
86
88
  }
@@ -103,11 +105,11 @@ public class DebugRoadRegen extends SubCommand {
103
105
  queue.setCompleteTask(() -> {
104
106
  player.sendMessage(
105
107
  TranslatableCaption.of("debugroadregen.regen_done"),
106
- Template.of("value", plot.getId().toString())
108
+ TagResolver.resolver("value", Tag.inserting(Component.text(plot.getId().toString())))
107
109
  );
108
110
  player.sendMessage(
109
111
  TranslatableCaption.of("debugroadregen.regen_all"),
110
- Template.of("value", "/plot regenallroads")
112
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot regenallroads")))
111
113
  );
112
114
  });
113
115
  manager.createRoadEast(plot, queue);
@@ -126,18 +128,18 @@ public class DebugRoadRegen extends SubCommand {
126
128
  } catch (NumberFormatException ignored) {
127
129
  player.sendMessage(
128
130
  TranslatableCaption.of("invalid.not_valid_number"),
129
- Template.of("value", "0, 256")
131
+ TagResolver.resolver("value", Tag.inserting(Component.text("0, 256")))
130
132
  );
131
133
  player.sendMessage(
132
134
  TranslatableCaption.of("commandconfig.command_syntax"),
133
- Template.of("value", DebugRoadRegen.USAGE)
135
+ TagResolver.resolver("value", Tag.inserting(Component.text(DebugRoadRegen.USAGE)))
134
136
  );
135
137
  return false;
136
138
  }
137
139
  } else if (args.length != 0) {
138
140
  player.sendMessage(
139
141
  TranslatableCaption.of("commandconfig.command_syntax"),
140
- Template.of("value", DebugRoadRegen.USAGE)
142
+ TagResolver.resolver("value", Tag.inserting(Component.text(DebugRoadRegen.USAGE)))
141
143
  );
142
144
  return false;
143
145
  }
@@ -155,11 +157,11 @@ public class DebugRoadRegen extends SubCommand {
155
157
  }
156
158
  player.sendMessage(
157
159
  TranslatableCaption.of("debugroadregen.schematic"),
158
- Template.of("command", "/plot createroadschematic")
160
+ TagResolver.resolver("command", Tag.inserting(Component.text("/plot createroadschematic")))
159
161
  );
160
162
  player.sendMessage(
161
163
  TranslatableCaption.of("debugroadregen.regenallroads"),
162
- Template.of("command", "/plot regenallroads")
164
+ TagResolver.resolver("command", Tag.inserting(Component.text("/plot regenallroads")))
163
165
  );
164
166
  boolean result = this.hybridUtils.scheduleSingleRegionRoadUpdate(plot, height);
165
167
  if (!result) {
Core/src/main/java/com/plotsquared/core/command/Delete.java CHANGED
@@ -32,7 +32,9 @@ import com.plotsquared.core.util.EconHandler;
32
32
  import com.plotsquared.core.util.EventDispatcher;
33
33
  import com.plotsquared.core.util.PlotExpression;
34
34
  import com.plotsquared.core.util.task.TaskManager;
35
- import net.kyori.adventure.text.minimessage.Template;
35
+ import net.kyori.adventure.text.Component;
36
+ import net.kyori.adventure.text.minimessage.tag.Tag;
37
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
36
38
  import org.checkerframework.checker.nullness.qual.NonNull;
37
39
 
38
40
 
@@ -77,7 +79,7 @@ public class Delete extends SubCommand {
77
79
  if (eventResult == Result.DENY) {
78
80
  player.sendMessage(
79
81
  TranslatableCaption.of("events.event_denied"),
80
- Template.of("value", "Delete")
82
+ TagResolver.resolver("value", Tag.inserting(Component.text("Delete")))
81
83
  );
82
84
  return true;
83
85
  }
@@ -112,14 +114,17 @@ public class Delete extends SubCommand {
112
114
  this.econHandler.depositMoney(player, value);
113
115
  player.sendMessage(
114
116
  TranslatableCaption.of("economy.added_balance"),
115
- Template.of("money", this.econHandler.format(value))
117
+ TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(value))))
116
118
  );
117
119
  }
118
120
  }
119
121
  player.sendMessage(
120
122
  TranslatableCaption.of("working.deleting_done"),
121
- Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
122
- Template.of("plot", plot.getId().toString())
123
+ TagResolver.resolver(
124
+ "amount",
125
+ Tag.inserting(Component.text(String.valueOf(System.currentTimeMillis() - start)))
126
+ ),
127
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
123
128
  );
124
129
  eventDispatcher.callPostDelete(plot);
125
130
  });
Core/src/main/java/com/plotsquared/core/command/Deny.java CHANGED
@@ -34,7 +34,9 @@ import com.plotsquared.core.util.PlayerManager;
34
34
  import com.plotsquared.core.util.TabCompletions;
35
35
  import com.plotsquared.core.util.WorldUtil;
36
36
  import com.sk89q.worldedit.world.gamemode.GameModes;
37
- import net.kyori.adventure.text.minimessage.Template;
37
+ import net.kyori.adventure.text.Component;
38
+ import net.kyori.adventure.text.minimessage.tag.Tag;
39
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
38
40
  import org.checkerframework.checker.nullness.qual.NonNull;
39
41
 
40
42
  import java.util.Collection;
@@ -88,7 +90,7 @@ public class Deny extends SubCommand {
88
90
  if (size >= maxDenySize) {
89
91
  player.sendMessage(
90
92
  TranslatableCaption.of("members.plot_max_members_denied"),
91
- Template.of("amount", String.valueOf(size))
93
+ TagResolver.resolver("amount", Tag.inserting(Component.text(size)))
92
94
  );
93
95
  return false;
94
96
  }
@@ -99,7 +101,7 @@ public class Deny extends SubCommand {
99
101
  } else if (throwable != null || uuids.isEmpty()) {
100
102
  player.sendMessage(
101
103
  TranslatableCaption.of("errors.invalid_player"),
102
- Template.of("value", args[0])
104
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
103
105
  );
104
106
  } else {
105
107
  for (UUID uuid : uuids) {
@@ -107,7 +109,7 @@ public class Deny extends SubCommand {
107
109
  player.hasPermission(Permission.PERMISSION_DENY_EVERYONE) || player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_DENY))) {
108
110
  player.sendMessage(
109
111
  TranslatableCaption.of("errors.invalid_player"),
110
- Template.of("value", args[0])
112
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
111
113
  );
112
114
  } else if (plot.isOwner(uuid)) {
113
115
  player.sendMessage(TranslatableCaption.of("deny.cant_remove_owner"));
@@ -115,7 +117,10 @@ public class Deny extends SubCommand {
115
117
  } else if (plot.getDenied().contains(uuid)) {
116
118
  player.sendMessage(
117
119
  TranslatableCaption.of("member.already_added"),
118
- Template.of("player", PlayerManager.resolveName(uuid).getComponent(player))
120
+ TagResolver.resolver(
121
+ "player",
122
+ Tag.inserting(PlayerManager.resolveName(uuid).toComponent(player))
123
+ )
119
124
  );
120
125
  return;
121
126
  } else {
Core/src/main/java/com/plotsquared/core/command/Desc.java CHANGED
@@ -27,7 +27,9 @@ import com.plotsquared.core.player.PlotPlayer;
27
27
  import com.plotsquared.core.plot.Plot;
28
28
  import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
29
29
  import com.plotsquared.core.util.EventDispatcher;
30
- import net.kyori.adventure.text.minimessage.Template;
30
+ import net.kyori.adventure.text.Component;
31
+ import net.kyori.adventure.text.minimessage.tag.Tag;
32
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
31
33
  import org.checkerframework.checker.nullness.qual.NonNull;
32
34
 
33
35
  @CommandDeclaration(command = "setdescription",
@@ -54,7 +56,7 @@ public class Desc extends SetCommand {
54
56
  if (event.getEventResult() == Result.DENY) {
55
57
  player.sendMessage(
56
58
  TranslatableCaption.of("events.event_denied"),
57
- Template.of("value", "Description removal")
59
+ TagResolver.resolver("value", Tag.inserting(Component.text("Description removal")))
58
60
  );
59
61
  return false;
60
62
  }
@@ -69,7 +71,7 @@ public class Desc extends SetCommand {
69
71
  if (event.getEventResult() == Result.DENY) {
70
72
  player.sendMessage(
71
73
  TranslatableCaption.of("events.event_denied"),
72
- Template.of("value", "Description set")
74
+ TagResolver.resolver("value", Tag.inserting(Component.text("Description set")))
73
75
  );
74
76
  return false;
75
77
  }
Core/src/main/java/com/plotsquared/core/command/Done.java CHANGED
@@ -35,7 +35,9 @@ import com.plotsquared.core.plot.flag.PlotFlag;
35
35
  import com.plotsquared.core.plot.flag.implementations.DoneFlag;
36
36
  import com.plotsquared.core.util.EventDispatcher;
37
37
  import com.plotsquared.core.util.task.RunnableVal;
38
- import net.kyori.adventure.text.minimessage.Template;
38
+ import net.kyori.adventure.text.Component;
39
+ import net.kyori.adventure.text.minimessage.tag.Tag;
40
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
39
41
  import org.checkerframework.checker.nullness.qual.NonNull;
40
42
 
41
43
  @CommandDeclaration(command = "done",
@@ -69,7 +71,7 @@ public class Done extends SubCommand {
69
71
  if (event.getEventResult() == Result.DENY) {
70
72
  player.sendMessage(
71
73
  TranslatableCaption.of("events.event_denied"),
72
- Template.of("value", "Done")
74
+ TagResolver.resolver("value", Tag.inserting(Component.text("Done")))
73
75
  );
74
76
  return true;
75
77
  }
@@ -89,7 +91,7 @@ public class Done extends SubCommand {
89
91
  plot.addRunning();
90
92
  player.sendMessage(
91
93
  TranslatableCaption.of("web.generating_link"),
92
- Template.of("plot", plot.getId().toString())
94
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
93
95
  );
94
96
  final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
95
97
  if (PlotSquared.platform().expireManager() == null || doneRequirements == null) {
Core/src/main/java/com/plotsquared/core/command/Download.java CHANGED
@@ -33,7 +33,9 @@ import com.plotsquared.core.util.StringMan;
33
33
  import com.plotsquared.core.util.TabCompletions;
34
34
  import com.plotsquared.core.util.WorldUtil;
35
35
  import com.plotsquared.core.util.task.RunnableVal;
36
- import net.kyori.adventure.text.minimessage.Template;
36
+ import net.kyori.adventure.text.Component;
37
+ import net.kyori.adventure.text.minimessage.tag.Tag;
38
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
37
39
  import org.checkerframework.checker.nullness.qual.NonNull;
38
40
 
39
41
  import java.net.URL;
@@ -111,7 +113,10 @@ public class Download extends SubCommand {
111
113
  if (!player.hasPermission(Permission.PERMISSION_DOWNLOAD_WORLD)) {
112
114
  player.sendMessage(
113
115
  TranslatableCaption.of("permission.no_permission"),
114
- Template.of("node", Permission.PERMISSION_DOWNLOAD_WORLD.toString())
116
+ TagResolver.resolver(
117
+ "node",
118
+ Tag.inserting(Permission.PERMISSION_DOWNLOAD_WORLD)
119
+ )
115
120
  );
116
121
  return false;
117
122
  }
@@ -125,18 +130,24 @@ public class Download extends SubCommand {
125
130
  if (url == null) {
126
131
  player.sendMessage(
127
132
  TranslatableCaption.of("web.generating_link_failed"),
128
- Template.of("plot", plot.getId().toString())
133
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
129
134
  );
130
135
  return;
131
136
  }
132
- player.sendMessage(TranslatableCaption.of("web.generation_link_success_legacy_world"), Template.of("url", url.toString()));
137
+ player.sendMessage(
138
+ TranslatableCaption.of("web.generation_link_success_legacy_world"),
139
+ TagResolver.resolver("url", Tag.inserting(Component.text(url.toString())))
140
+ );
133
141
  }
134
142
  });
135
143
  } else {
136
144
  sendUsage(player);
137
145
  return false;
138
146
  }
139
- player.sendMessage(TranslatableCaption.of("web.generating_link"), Template.of("plot", plot.getId().toString()));
147
+ player.sendMessage(
148
+ TranslatableCaption.of("web.generating_link"),
149
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
150
+ );
140
151
  return true;
141
152
  }
142
153
 
@@ -181,8 +192,10 @@ public class Download extends SubCommand {
181
192
  plot.removeRunning();
182
193
  player.sendMessage(
183
194
  TranslatableCaption.of("web.generation_link_success"),
184
- Template.of("download", value.toString()),
185
- Template.of("delete", "Not available")
195
+ TagResolver.builder()
196
+ .tag("download", Tag.preProcessParsed(value.toString()))
197
+ .tag("delete", Tag.preProcessParsed("Not available"))
198
+ .build()
186
199
  );
187
200
  player.sendMessage(StaticCaption.of(value.toString()));
188
201
  }
@@ -196,13 +209,15 @@ public class Download extends SubCommand {
196
209
  if (throwable != null || !result.isSuccess()) {
197
210
  player.sendMessage(
198
211
  TranslatableCaption.of("web.generating_link_failed"),
199
- Template.of("plot", plot.getId().toString())
212
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
200
213
  );
201
214
  } else {
202
215
  player.sendMessage(
203
216
  TranslatableCaption.of("web.generation_link_success"),
204
- Template.of("download", result.getDownloadUrl()),
205
- Template.of("delete", result.getDeletionUrl())
217
+ TagResolver.builder()
218
+ .tag("download", Tag.preProcessParsed(result.getDownloadUrl()))
219
+ .tag("delete", Tag.preProcessParsed(result.getDeletionUrl()))
220
+ .build()
206
221
  );
207
222
  }
208
223
  });
Core/src/main/java/com/plotsquared/core/command/FlagCommand.java CHANGED
@@ -23,7 +23,6 @@ import com.plotsquared.core.PlotSquared;
23
23
  import com.plotsquared.core.configuration.Settings;
24
24
  import com.plotsquared.core.configuration.caption.CaptionUtility;
25
25
  import com.plotsquared.core.configuration.caption.StaticCaption;
26
- import com.plotsquared.core.configuration.caption.Templates;
27
26
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
28
27
  import com.plotsquared.core.events.PlotFlagAddEvent;
29
28
  import com.plotsquared.core.events.PlotFlagRemoveEvent;
@@ -47,7 +46,9 @@ import com.plotsquared.core.util.task.RunnableVal2;
47
46
  import com.plotsquared.core.util.task.RunnableVal3;
48
47
  import net.kyori.adventure.text.Component;
49
48
  import net.kyori.adventure.text.TextComponent;
50
- import net.kyori.adventure.text.minimessage.Template;
49
+ import net.kyori.adventure.text.format.Style;
50
+ import net.kyori.adventure.text.minimessage.tag.Tag;
51
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
51
52
  import org.checkerframework.checker.nullness.qual.NonNull;
52
53
  import org.checkerframework.checker.nullness.qual.Nullable;
53
54
 
@@ -84,7 +85,10 @@ public final class FlagCommand extends Command {
84
85
  private static boolean sendMessage(PlotPlayer<?> player) {
85
86
  player.sendMessage(
86
87
  TranslatableCaption.of("commandconfig.command_syntax"),
87
- Template.of("value", "/plot flag <set | remove | add | list | info> <flag> <value>")
88
+ TagResolver.resolver(
89
+ "value",
90
+ Tag.inserting(Component.text("/plot flag <set | remove | add | list | info> <flag> <value>"))
91
+ )
88
92
  );
89
93
  return true;
90
94
  }
@@ -110,9 +114,9 @@ public final class FlagCommand extends Command {
110
114
  if (!result) {
111
115
  player.sendMessage(
112
116
  TranslatableCaption.of("permission.no_permission"),
113
- Template.of(
117
+ TagResolver.resolver(
114
118
  "node",
115
- perm + "." + numeric
119
+ Tag.inserting(Component.text(perm + "." + numeric))
116
120
  )
117
121
  );
118
122
  }
@@ -129,16 +133,21 @@ public final class FlagCommand extends Command {
129
133
  );
130
134
  final boolean result = player.hasPermission(permission);
131
135
  if (!result) {
132
- player.sendMessage(TranslatableCaption.of("permission.no_permission"), Template.of("node", permission));
136
+ player.sendMessage(
137
+ TranslatableCaption.of("permission.no_permission"),
138
+ TagResolver.resolver("node", Tag.inserting(Component.text(permission)))
139
+ );
133
140
  return false;
134
141
  }
135
142
  }
136
143
  } catch (final FlagParseException e) {
137
144
  player.sendMessage(
138
145
  TranslatableCaption.of("flag.flag_parse_error"),
139
- Template.of("flag_name", flag.getName()),
140
- Template.of("flag_value", e.getValue()),
141
- Template.of("error", e.getErrorMessage().getComponent(player))
146
+ TagResolver.builder()
147
+ .tag("flag_name", Tag.inserting(Component.text(flag.getName())))
148
+ .tag("flag_value", Tag.inserting(Component.text(e.getValue())))
149
+ .tag("error", Tag.inserting(e.getErrorMessage().toComponent(player)))
150
+ .build()
142
151
  );
143
152
  return false;
144
153
  } catch (final Exception e) {
@@ -155,7 +164,10 @@ public final class FlagCommand extends Command {
155
164
  perm = basePerm;
156
165
  }
157
166
  if (!result) {
158
- player.sendMessage(TranslatableCaption.of("permission.no_permission"), Template.of("node", perm));
167
+ player.sendMessage(
168
+ TranslatableCaption.of("permission.no_permission"),
169
+ TagResolver.resolver("node", Tag.inserting(Component.text(perm)))
170
+ );
159
171
  }
160
172
  return result;
161
173
  }
@@ -179,7 +191,7 @@ public final class FlagCommand extends Command {
179
191
  if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_SET_FLAG_OTHER)) {
180
192
  player.sendMessage(
181
193
  TranslatableCaption.of("permission.no_permission"),
182
- Template.of("node", String.valueOf(Permission.PERMISSION_SET_FLAG_OTHER))
194
+ TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_SET_FLAG_OTHER))
183
195
  );
184
196
  return false;
185
197
  }
@@ -214,7 +226,7 @@ public final class FlagCommand extends Command {
214
226
  if (best != null) {
215
227
  player.sendMessage(
216
228
  TranslatableCaption.of("flag.not_valid_flag_suggested"),
217
- Template.of("value", best)
229
+ TagResolver.resolver("value", Tag.inserting(Component.text(best)))
218
230
  );
219
231
  suggested = true;
220
232
  }
@@ -323,7 +335,7 @@ public final class FlagCommand extends Command {
323
335
  if (args.length < 2) {
324
336
  player.sendMessage(
325
337
  TranslatableCaption.of("commandconfig.command_syntax"),
326
- Template.of("value", "/plot flag set <flag> <value>")
338
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot flag set <flag> <value>")))
327
339
  );
328
340
  return;
329
341
  }
@@ -336,7 +348,7 @@ public final class FlagCommand extends Command {
336
348
  if (event.getEventResult() == Result.DENY) {
337
349
  player.sendMessage(
338
350
  TranslatableCaption.of("events.event_denied"),
339
- Template.of("value", "Flag set")
351
+ TagResolver.resolver("value", Tag.inserting(Component.text("Flag set")))
340
352
  );
341
353
  return;
342
354
  }
@@ -352,15 +364,21 @@ public final class FlagCommand extends Command {
352
364
  } catch (final FlagParseException e) {
353
365
  player.sendMessage(
354
366
  TranslatableCaption.of("flag.flag_parse_error"),
355
- Template.of("flag_name", plotFlag.getName()),
356
- Template.of("flag_value", e.getValue()),
357
- Template.of("error", e.getErrorMessage().getComponent(player))
367
+ TagResolver.builder()
368
+ .tag("flag_name", Tag.inserting(Component.text(plotFlag.getName())))
369
+ .tag("flag_value", Tag.inserting(Component.text(e.getValue())))
370
+ .tag("error", Tag.inserting(e.getErrorMessage().toComponent(player)))
371
+ .build()
358
372
  );
359
373
  return;
360
374
  }
361
375
  plot.setFlag(parsed);
362
- player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])),
363
- Template.of("value", String.valueOf(parsed))
376
+ player.sendMessage(
377
+ TranslatableCaption.of("flag.flag_added"),
378
+ TagResolver.builder()
379
+ .tag("flag", Tag.inserting(Component.text(args[0])))
380
+ .tag("value", Tag.inserting(Component.text(parsed.toString())))
381
+ .build()
364
382
  );
365
383
  }
366
384
 
@@ -382,7 +400,7 @@ public final class FlagCommand extends Command {
382
400
  if (args.length < 2) {
383
401
  player.sendMessage(
384
402
  TranslatableCaption.of("commandconfig.command_syntax"),
385
- Template.of("value", "/plot flag add <flag> <values>")
403
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot flag add <flag> <values>")))
386
404
  );
387
405
  return;
388
406
  }
@@ -395,7 +413,7 @@ public final class FlagCommand extends Command {
395
413
  if (event.getEventResult() == Result.DENY) {
396
414
  player.sendMessage(
397
415
  TranslatableCaption.of("events.event_denied"),
398
- Template.of("value", "Flag add")
416
+ TagResolver.resolver("value", Tag.inserting(Component.text("Flag add")))
399
417
  );
400
418
  return;
401
419
  }
@@ -416,9 +434,11 @@ public final class FlagCommand extends Command {
416
434
  } catch (FlagParseException e) {
417
435
  player.sendMessage(
418
436
  TranslatableCaption.of("flag.flag_parse_error"),
419
- Template.of("flag_name", plotFlag.getName()),
420
- Template.of("flag_value", e.getValue()),
421
- Template.of("error", e.getErrorMessage().getComponent(player))
437
+ TagResolver.builder()
438
+ .tag("flag_name", Tag.inserting(Component.text(plotFlag.getName())))
439
+ .tag("flag_value", Tag.inserting(Component.text(e.getValue())))
440
+ .tag("error", Tag.inserting(e.getErrorMessage().toComponent(player)))
441
+ .build()
422
442
  );
423
443
  return;
424
444
  }
@@ -428,8 +448,12 @@ public final class FlagCommand extends Command {
428
448
  player.sendMessage(TranslatableCaption.of("flag.flag_not_added"));
429
449
  return;
430
450
  }
431
- player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])),
432
- Template.of("value", String.valueOf(parsed))
451
+ player.sendMessage(
452
+ TranslatableCaption.of("flag.flag_added"),
453
+ TagResolver.builder()
454
+ .tag("flag", Tag.inserting(Component.text(args[0])))
455
+ .tag("value", Tag.inserting(Component.text(parsed.toString())))
456
+ .build()
433
457
  );
434
458
  }
435
459
 
@@ -451,7 +475,7 @@ public final class FlagCommand extends Command {
451
475
  if (args.length != 1 && args.length != 2) {
452
476
  player.sendMessage(
453
477
  TranslatableCaption.of("commandconfig.command_syntax"),
454
- Template.of("value", "/plot flag remove <flag> [values]")
478
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot flag remove <flag> [values]")))
455
479
  );
456
480
  return;
457
481
  }
@@ -465,7 +489,7 @@ public final class FlagCommand extends Command {
465
489
  if (event.getEventResult() == Result.DENY) {
466
490
  player.sendMessage(
467
491
  TranslatableCaption.of("events.event_denied"),
468
- Template.of("value", "Flag remove")
492
+ TagResolver.resolver("value", Tag.inserting(Component.text("Flag remove")))
469
493
  );
470
494
  return;
471
495
  }
@@ -475,7 +499,10 @@ public final class FlagCommand extends Command {
475
499
  if (args.length != 2) {
476
500
  player.sendMessage(
477
501
  TranslatableCaption.of("permission.no_permission"),
478
- Template.of("node", Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase()))
502
+ TagResolver.resolver(
503
+ "node",
504
+ Tag.inserting(Component.text(Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase())))
505
+ )
479
506
  );
480
507
  return;
481
508
  }
@@ -490,9 +517,11 @@ public final class FlagCommand extends Command {
490
517
  } catch (final FlagParseException e) {
491
518
  player.sendMessage(
492
519
  TranslatableCaption.of("flag.flag_parse_error"),
493
- Template.of("flag_name", flag.getName()),
494
- Template.of("flag_value", e.getValue()),
495
- Template.of("error", String.valueOf(e.getErrorMessage()))
520
+ TagResolver.builder()
521
+ .tag("flag_name", Tag.inserting(Component.text(flag.getName())))
522
+ .tag("flag_value", Tag.inserting(Component.text(e.getValue())))
523
+ .tag("error", Tag.inserting(e.getErrorMessage().toComponent(player)))
524
+ .build()
496
525
  );
497
526
  return;
498
527
  }
@@ -503,10 +532,13 @@ public final class FlagCommand extends Command {
503
532
  if (list.removeAll((List) parsedFlag.getValue())) {
504
533
  if (list.isEmpty()) {
505
534
  if (plot.removeFlag(flag)) {
506
- player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of(
507
- "value",
508
- String.valueOf(flagWithOldValue)
509
- ));
535
+ player.sendMessage(
536
+ TranslatableCaption.of("flag.flag_removed"),
537
+ TagResolver.builder()
538
+ .tag("flag", Tag.inserting(Component.text(args[0])))
539
+ .tag("value", Tag.inserting(Component.text(flag.toString())))
540
+ .build()
541
+ );
510
542
  return;
511
543
  } else {
512
544
  player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
@@ -518,7 +550,10 @@ public final class FlagCommand extends Command {
518
550
  if (addEvent.getEventResult() == Result.DENY) {
519
551
  player.sendMessage(
520
552
  TranslatableCaption.of("events.event_denied"),
521
- Template.of("value", "Re-addition of " + plotFlag.getName())
553
+ TagResolver.resolver(
554
+ "value",
555
+ Tag.inserting(Component.text("Re-addition of " + plotFlag.getName()))
556
+ )
522
557
  );
523
558
  return;
524
559
  }
@@ -541,10 +576,13 @@ public final class FlagCommand extends Command {
541
576
  return;
542
577
  }
543
578
  }
544
- player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of(
545
- "value",
546
- String.valueOf(flagWithOldValue)
547
- ));
579
+ player.sendMessage(
580
+ TranslatableCaption.of("flag.flag_removed"),
581
+ TagResolver.builder()
582
+ .tag("flag", Tag.inserting(Component.text(args[0])))
583
+ .tag("value", Tag.inserting(Component.text(flag.toString())))
584
+ .build()
585
+ );
548
586
  }
549
587
 
550
588
  @CommandDeclaration(command = "list",
@@ -562,34 +600,35 @@ public final class FlagCommand extends Command {
562
600
  return;
563
601
  }
564
602
 
565
- final Map<String, ArrayList<String>> flags = new HashMap<>();
603
+ final Map<Component, ArrayList<String>> flags = new HashMap<>();
566
604
  for (PlotFlag<?, ?> plotFlag : GlobalFlagContainer.getInstance().getRecognizedPlotFlags()) {
567
605
  if (plotFlag instanceof InternalFlag) {
568
606
  continue;
569
607
  }
570
- final String category = MINI_MESSAGE.stripTokens(plotFlag.getFlagCategory().getComponent(player));
571
- final Collection<String> flagList =
572
- flags.computeIfAbsent(category, k -> new ArrayList<>());
608
+ final Component category = plotFlag.getFlagCategory().toComponent(player);
609
+ final Collection<String> flagList = flags.computeIfAbsent(category, k -> new ArrayList<>());
573
610
  flagList.add(plotFlag.getName());
574
611
  }
575
612
 
576
- for (final Map.Entry<String, ArrayList<String>> entry : flags.entrySet()) {
613
+ for (final Map.Entry<Component, ArrayList<String>> entry : flags.entrySet()) {
577
614
  Collections.sort(entry.getValue());
578
615
  Component category =
579
- MINI_MESSAGE.parse(
616
+ MINI_MESSAGE.deserialize(
580
617
  TranslatableCaption.of("flag.flag_list_categories").getComponent(player),
581
- Template.of("category", entry.getKey())
618
+ TagResolver.resolver("category", Tag.inserting(entry.getKey().style(Style.empty())))
582
619
  );
583
620
  TextComponent.Builder builder = Component.text().append(category);
584
621
  final Iterator<String> flagIterator = entry.getValue().iterator();
585
622
  while (flagIterator.hasNext()) {
586
623
  final String flag = flagIterator.next();
587
624
  builder.append(MINI_MESSAGE
588
- .parse(
625
+ .deserialize(
589
626
  TranslatableCaption.of("flag.flag_list_flag").getComponent(player),
590
- Template.of("command", "/plot flag info " + flag),
591
- Template.of("flag", flag),
592
- Template.of("suffix", flagIterator.hasNext() ? ", " : "")
627
+ TagResolver.builder()
628
+ .tag("command", Tag.preProcessParsed("/plot flag info " + flag))
629
+ .tag("flag", Tag.inserting(Component.text(flag)))
630
+ .tag("suffix", Tag.inserting(Component.text(flagIterator.hasNext() ? ", " : "")))
631
+ .build()
593
632
  ));
594
633
  }
595
634
  player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build())));
@@ -613,7 +652,7 @@ public final class FlagCommand extends Command {
613
652
  if (args.length < 1) {
614
653
  player.sendMessage(
615
654
  TranslatableCaption.of("commandconfig.command_syntax"),
616
- Template.of("value", "/plot flag info <flag>")
655
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot flag info <flag>")))
617
656
  );
618
657
  return;
619
658
  }
@@ -621,11 +660,17 @@ public final class FlagCommand extends Command {
621
660
  if (plotFlag != null) {
622
661
  player.sendMessage(TranslatableCaption.of("flag.flag_info_header"));
623
662
  // Flag name
624
- player.sendMessage(TranslatableCaption.of("flag.flag_info_name"), Template.of("flag", plotFlag.getName()));
663
+ player.sendMessage(
664
+ TranslatableCaption.of("flag.flag_info_name"),
665
+ TagResolver.resolver("flag", Tag.inserting(Component.text(plotFlag.getName())))
666
+ );
625
667
  // Flag category
626
668
  player.sendMessage(
627
669
  TranslatableCaption.of("flag.flag_info_category"),
628
- Templates.of(player, "value", plotFlag.getFlagCategory())
670
+ TagResolver.resolver(
671
+ "value",
672
+ Tag.inserting(plotFlag.getFlagCategory().toComponent(player))
673
+ )
629
674
  );
630
675
  // Flag description
631
676
  // TODO maybe merge and \n instead?
@@ -634,16 +679,18 @@ public final class FlagCommand extends Command {
634
679
  // Flag example
635
680
  player.sendMessage(
636
681
  TranslatableCaption.of("flag.flag_info_example"),
637
- Template.of("command", "/plot flag set"),
638
- Template.of("flag", plotFlag.getName()),
639
- Template.of("value", plotFlag.getExample())
682
+ TagResolver.builder()
683
+ .tag("command", Tag.preProcessParsed("/plot flag set"))
684
+ .tag("flag", Tag.preProcessParsed(plotFlag.getName()))
685
+ .tag("value", Tag.preProcessParsed(plotFlag.getExample()))
686
+ .build()
640
687
  );
641
688
  // Default value
642
689
  final String defaultValue = player.getLocation().getPlotArea().getFlagContainer()
643
690
  .getFlagErased(plotFlag.getClass()).toString();
644
691
  player.sendMessage(
645
692
  TranslatableCaption.of("flag.flag_info_default_value"),
646
- Template.of("value", defaultValue)
693
+ TagResolver.resolver("value", Tag.inserting(Component.text(defaultValue)))
647
694
  );
648
695
  // Footer. Done this way to prevent the duplicate-message-thingy from catching it
649
696
  player.sendMessage(TranslatableCaption.of("flag.flag_info_footer"));
Core/src/main/java/com/plotsquared/core/command/Grant.java CHANGED
@@ -31,7 +31,9 @@ import com.plotsquared.core.util.TabCompletions;
31
31
  import com.plotsquared.core.util.task.RunnableVal;
32
32
  import com.plotsquared.core.util.task.RunnableVal2;
33
33
  import com.plotsquared.core.util.task.RunnableVal3;
34
- import net.kyori.adventure.text.minimessage.Template;
34
+ import net.kyori.adventure.text.Component;
35
+ import net.kyori.adventure.text.minimessage.tag.Tag;
36
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
35
37
 
36
38
  import java.util.Collection;
37
39
  import java.util.Collections;
@@ -63,7 +65,7 @@ public class Grant extends Command {
63
65
  checkTrue(
64
66
  args.length >= 1 && args.length <= 2,
65
67
  TranslatableCaption.of("commandconfig.command_syntax"),
66
- Template.of("value", "/plot grant <check | add> [player]")
68
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot grant <check | add> [player]")))
67
69
  );
68
70
  final String arg0 = args[0].toLowerCase();
69
71
  switch (arg0) {
@@ -71,7 +73,7 @@ public class Grant extends Command {
71
73
  if (!player.hasPermission(Permission.PERMISSION_GRANT.format(arg0))) {
72
74
  player.sendMessage(
73
75
  TranslatableCaption.of("permission.no_permission"),
74
- Template.of("node", Permission.PERMISSION_GRANT.format(arg0))
76
+ TagResolver.resolver("node", Tag.inserting(Component.text(Permission.PERMISSION_GRANT.format(arg0))))
75
77
  );
76
78
  return CompletableFuture.completedFuture(false);
77
79
  }
@@ -84,7 +86,7 @@ public class Grant extends Command {
84
86
  } else if (throwable != null || uuids.size() != 1) {
85
87
  player.sendMessage(
86
88
  TranslatableCaption.of("errors.invalid_player"),
87
- Template.of("value", String.valueOf(uuids))
89
+ TagResolver.resolver("value", Tag.inserting(Component.text(String.valueOf(uuids))))
88
90
  );
89
91
  } else {
90
92
  final UUID uuid = uuids.iterator().next();
@@ -95,7 +97,7 @@ public class Grant extends Command {
95
97
  if (args[0].equalsIgnoreCase("check")) {
96
98
  player.sendMessage(
97
99
  TranslatableCaption.of("grants.granted_plots"),
98
- Template.of("amount", String.valueOf(access.get().orElse(0)))
100
+ TagResolver.resolver("amount", Tag.inserting(Component.text(access.get().orElse(0))))
99
101
  );
100
102
  } else {
101
103
  access.set(access.get().orElse(0) + 1);
@@ -115,7 +117,7 @@ public class Grant extends Command {
115
117
  }
116
118
  player.sendMessage(
117
119
  TranslatableCaption.of("grants.granted_plots"),
118
- Template.of("amount", String.valueOf(granted))
120
+ TagResolver.resolver("amount", Tag.inserting(Component.text(granted)))
119
121
  );
120
122
  } else { // add
121
123
  int amount;
@@ -130,7 +132,7 @@ public class Grant extends Command {
130
132
  DBFunc.addPersistentMeta(uuid, key, rawData, replace);
131
133
  player.sendMessage(
132
134
  TranslatableCaption.of("grants.added"),
133
- Template.of("grants", String.valueOf(amount))
135
+ TagResolver.resolver("grants", Tag.inserting(Component.text(amount)))
134
136
  );
135
137
  }
136
138
  }
Core/src/main/java/com/plotsquared/core/command/Help.java CHANGED
@@ -28,7 +28,8 @@ import com.plotsquared.core.util.task.RunnableVal2;
28
28
  import com.plotsquared.core.util.task.RunnableVal3;
29
29
  import net.kyori.adventure.text.Component;
30
30
  import net.kyori.adventure.text.TextComponent;
31
- import net.kyori.adventure.text.minimessage.Template;
31
+ import net.kyori.adventure.text.minimessage.tag.Tag;
32
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
32
33
 
33
34
  import java.util.ArrayList;
34
35
  import java.util.Collection;
@@ -110,27 +111,31 @@ public class Help extends Command {
110
111
  }
111
112
  if (cat == null && page == 0) {
112
113
  TextComponent.Builder builder = Component.text();
113
- builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_header").getComponent(player)));
114
+ builder.append(MINI_MESSAGE.deserialize(TranslatableCaption.of("help.help_header").getComponent(player)));
114
115
  for (CommandCategory c : CommandCategory.values()) {
115
116
  if (!c.canAccess(player)) {
116
117
  continue;
117
118
  }
118
119
  builder.append(Component.newline()).append(MINI_MESSAGE
119
- .parse(
120
+ .deserialize(
120
121
  TranslatableCaption.of("help.help_info_item").getComponent(player),
121
- Template.of("command", "/plot help"),
122
- Template.of("category", c.name().toLowerCase()),
123
- Template.of("category_desc", c.getComponent(player))
122
+ TagResolver.builder()
123
+ .tag("command", Tag.inserting(Component.text("/plot help")))
124
+ .tag("category", Tag.inserting(Component.text(c.name().toLowerCase())))
125
+ .tag("category_desc", Tag.inserting(c.toComponent(player)))
126
+ .build()
124
127
  ));
125
128
  }
126
129
  builder.append(Component.newline()).append(MINI_MESSAGE
127
- .parse(
130
+ .deserialize(
128
131
  TranslatableCaption.of("help.help_info_item").getComponent(player),
129
- Template.of("command", "/plot help"),
130
- Template.of("category", "all"),
131
- Template.of("category_desc", "Display all commands")
132
+ TagResolver.builder()
133
+ .tag("command", Tag.inserting(Component.text("/plot help")))
134
+ .tag("category", Tag.inserting(Component.text("all")))
135
+ .tag("category_desc", Tag.inserting(TranslatableCaption.of("help.help_display_all_commands").toComponent(player)))
136
+ .build()
132
137
  ));
133
- builder.append(Component.newline()).append(MINI_MESSAGE.parse(TranslatableCaption
138
+ builder.append(Component.newline()).append(MINI_MESSAGE.deserialize(TranslatableCaption
134
139
  .of("help.help_footer")
135
140
  .getComponent(player)));
136
141
  player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.asComponent())));
Core/src/main/java/com/plotsquared/core/command/HomeCommand.java CHANGED
@@ -34,7 +34,9 @@ import com.plotsquared.core.util.query.PlotQuery;
34
34
  import com.plotsquared.core.util.query.SortingStrategy;
35
35
  import com.plotsquared.core.util.task.RunnableVal2;
36
36
  import com.plotsquared.core.util.task.RunnableVal3;
37
- import net.kyori.adventure.text.minimessage.Template;
37
+ import net.kyori.adventure.text.Component;
38
+ import net.kyori.adventure.text.minimessage.tag.Tag;
39
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
38
40
  import org.checkerframework.checker.nullness.qual.NonNull;
39
41
 
40
42
  import java.util.ArrayList;
@@ -71,8 +73,10 @@ public class HomeCommand extends Command {
71
73
  } else if (plots.size() < page || page < 1) {
72
74
  player.sendMessage(
73
75
  TranslatableCaption.of("invalid.number_not_in_range"),
74
- Template.of("min", "1"),
75
- Template.of("max", String.valueOf(plots.size()))
76
+ TagResolver.builder()
77
+ .tag("min", Tag.inserting(Component.text(1)))
78
+ .tag("max", Tag.inserting(Component.text(plots.size())))
79
+ .build()
76
80
  );
77
81
  return;
78
82
  }
@@ -106,7 +110,7 @@ public class HomeCommand extends Command {
106
110
  if (!player.hasPermission(Permission.PERMISSION_VISIT_OWNED) && !player.hasPermission(Permission.PERMISSION_HOME)) {
107
111
  player.sendMessage(
108
112
  TranslatableCaption.of("permission.no_permission"),
109
- Template.of("node", Permission.PERMISSION_VISIT_OWNED.toString())
113
+ TagResolver.resolver("node", Tag.inserting(Component.text(Permission.PERMISSION_VISIT_OWNED.toString())))
110
114
  );
111
115
  return CompletableFuture.completedFuture(false);
112
116
  }
@@ -128,7 +132,7 @@ public class HomeCommand extends Command {
128
132
  } catch (NumberFormatException ignored) {
129
133
  player.sendMessage(
130
134
  TranslatableCaption.of("invalid.not_a_number"),
131
- Template.of("value", identifier)
135
+ TagResolver.resolver("value", Tag.inserting(Component.text(identifier)))
132
136
  );
133
137
  return CompletableFuture.completedFuture(false);
134
138
  }
@@ -169,7 +173,7 @@ public class HomeCommand extends Command {
169
173
  } catch (NumberFormatException ignored) {
170
174
  player.sendMessage(
171
175
  TranslatableCaption.of("invalid.not_a_number"),
172
- Template.of("value", identifier)
176
+ TagResolver.resolver("value", Tag.inserting(Component.text(identifier)))
173
177
  );
174
178
  return CompletableFuture.completedFuture(false);
175
179
  }
Core/src/main/java/com/plotsquared/core/command/Inbox.java CHANGED
@@ -20,7 +20,6 @@ package com.plotsquared.core.command;
20
20
 
21
21
  import com.google.inject.TypeLiteral;
22
22
  import com.plotsquared.core.configuration.caption.StaticCaption;
23
- import com.plotsquared.core.configuration.caption.Templates;
24
23
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
25
24
  import com.plotsquared.core.permissions.Permission;
26
25
  import com.plotsquared.core.player.MetaDataAccess;
@@ -35,7 +34,8 @@ import com.plotsquared.core.util.TabCompletions;
35
34
  import com.plotsquared.core.util.task.RunnableVal;
36
35
  import net.kyori.adventure.text.Component;
37
36
  import net.kyori.adventure.text.TextComponent;
38
- import net.kyori.adventure.text.minimessage.Template;
37
+ import net.kyori.adventure.text.minimessage.tag.Tag;
38
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
39
39
 
40
40
  import java.util.Collection;
41
41
  import java.util.Collections;
@@ -71,9 +71,14 @@ public class Inbox extends SubCommand {
71
71
  max = comments.length;
72
72
  }
73
73
  TextComponent.Builder builder = Component.text();
74
- builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("list.comment_list_header_paged").getComponent(player) + '\n',
75
- Template.of("amount", String.valueOf(comments.length)), Template.of("cur", String.valueOf(page + 1)),
76
- Template.of("max", String.valueOf(totalPages + 1)), Template.of("word", "all")
74
+ builder.append(MINI_MESSAGE.deserialize(
75
+ TranslatableCaption.of("list.comment_list_header_paged").getComponent(player) + '\n',
76
+ TagResolver.builder()
77
+ .tag("amount", Tag.inserting(Component.text(comments.length)))
78
+ .tag("cur", Tag.inserting(Component.text(page + 1)))
79
+ .tag("max", Tag.inserting(Component.text(totalPages + 1)))
80
+ .tag("word", Tag.inserting(Component.text("all")))
81
+ .build()
77
82
  ));
78
83
 
79
84
  // This might work xD
@@ -82,30 +87,28 @@ public class Inbox extends SubCommand {
82
87
  Component commentColored;
83
88
  if (player.getName().equals(comment.senderName)) {
84
89
  commentColored = MINI_MESSAGE
85
- .parse(
90
+ .deserialize(
86
91
  TranslatableCaption.of("list.comment_list_by_lister").getComponent(player),
87
- Template.of("comment", comment.comment)
92
+ TagResolver.resolver("comment", Tag.inserting(Component.text(comment.comment)))
88
93
  );
89
94
  } else {
90
95
  commentColored = MINI_MESSAGE
91
- .parse(
96
+ .deserialize(
92
97
  TranslatableCaption.of("list.comment_list_by_other").getComponent(player),
93
- Template.of("comment", comment.comment)
98
+ TagResolver.resolver("comment", Tag.inserting(Component.text(comment.comment)))
94
99
  );
95
100
  }
96
- Template number = Template.of("number", String.valueOf(x));
97
- Template world = Template.of("world", comment.world);
98
- Template plot_id = Template.of("plot_id", comment.id.getX() + ";" + comment.id.getY());
99
- Template commenter = Template.of("commenter", comment.senderName);
100
- Template commentTemplate = Template.of("comment", commentColored);
101
+ TagResolver resolver = TagResolver.builder()
102
+ .tag("number", Tag.inserting(Component.text(x)))
103
+ .tag("world", Tag.inserting(Component.text(comment.world)))
104
+ .tag("plot_id", Tag.inserting(Component.text(comment.id.getX() + ";" + comment.id.getY())))
105
+ .tag("commenter", Tag.inserting(Component.text(comment.senderName)))
106
+ .tag("comment", Tag.inserting(commentColored))
107
+ .build();
101
108
  builder.append(MINI_MESSAGE
102
- .parse(
109
+ .deserialize(
103
110
  TranslatableCaption.of("list.comment_list_comment").getComponent(player),
104
- number,
105
- world,
106
- plot_id,
107
- commenter,
108
- commentTemplate
111
+ resolver
109
112
  ));
110
113
  }
111
114
  player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build())));
@@ -142,20 +145,23 @@ public class Inbox extends SubCommand {
142
145
  if (total != 0) {
143
146
  player.sendMessage(
144
147
  TranslatableCaption.of("comment.inbox_item"),
145
- Template.of("value", inbox + " (" + total + '/' + unread + ')')
148
+ TagResolver.resolver(
149
+ "value",
150
+ Tag.inserting(Component.text(inbox + " (" + total + '/' + unread + ')'))
151
+ )
146
152
  );
147
153
  return;
148
154
  }
149
155
  }
150
156
  player.sendMessage(
151
157
  TranslatableCaption.of("comment.inbox_item"),
152
- Template.of("value", inbox.toString())
158
+ TagResolver.resolver("value", Tag.inserting(Component.text(inbox.toString())))
153
159
  );
154
160
  }
155
161
  })) {
156
162
  player.sendMessage(
157
163
  TranslatableCaption.of("comment.inbox_item"),
158
- Template.of("value", inbox.toString())
164
+ TagResolver.resolver("value", Tag.inserting(Component.text(inbox.toString())))
159
165
  );
160
166
  }
161
167
  }
@@ -166,7 +172,10 @@ public class Inbox extends SubCommand {
166
172
  if (inbox == null) {
167
173
  player.sendMessage(
168
174
  TranslatableCaption.of("comment.invalid_inbox"),
169
- Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), ", "))
175
+ TagResolver.resolver(
176
+ "list",
177
+ Tag.inserting(Component.text(StringMan.join(CommentManager.inboxes.keySet(), ", ")))
178
+ )
170
179
  );
171
180
  return false;
172
181
  }
@@ -189,7 +198,10 @@ public class Inbox extends SubCommand {
189
198
  if (args.length != 3) {
190
199
  player.sendMessage(
191
200
  TranslatableCaption.of("commandconfig.command_syntax"),
192
- Template.of("value", "/plot inbox " + inbox + " delete <index>")
201
+ TagResolver.resolver(
202
+ "value",
203
+ Tag.inserting(Component.text("/plot inbox " + inbox + " delete <index>"))
204
+ )
193
205
  );
194
206
  return true;
195
207
  }
@@ -199,14 +211,17 @@ public class Inbox extends SubCommand {
199
211
  if (index < 1) {
200
212
  player.sendMessage(
201
213
  TranslatableCaption.of("comment.not_valid_inbox_index"),
202
- Templates.of("number", index)
214
+ TagResolver.resolver("number", Tag.inserting(Component.text(index)))
203
215
  );
204
216
  return false;
205
217
  }
206
218
  } catch (NumberFormatException ignored) {
207
219
  player.sendMessage(
208
220
  TranslatableCaption.of("commandconfig.command_syntax"),
209
- Template.of("value", "/plot inbox " + inbox + " delete <index>")
221
+ TagResolver.resolver(
222
+ "value",
223
+ Tag.inserting(Component.text("/plot inbox " + inbox + " delete <index>"))
224
+ )
210
225
  );
211
226
  return false;
212
227
  }
@@ -217,7 +232,7 @@ public class Inbox extends SubCommand {
217
232
  if (index > value.size()) {
218
233
  player.sendMessage(
219
234
  TranslatableCaption.of("comment.not_valid_inbox_index"),
220
- Templates.of("number", index)
235
+ TagResolver.resolver("number", Tag.inserting(Component.text(index)))
221
236
  );
222
237
  return;
223
238
  }
@@ -227,7 +242,7 @@ public class Inbox extends SubCommand {
227
242
  if (success) {
228
243
  player.sendMessage(
229
244
  TranslatableCaption.of("comment.comment_removed_success"),
230
- Template.of("value", comment.comment)
245
+ TagResolver.resolver("value", Tag.inserting(Component.text(comment.comment)))
231
246
  );
232
247
  } else {
233
248
  player.sendMessage(
@@ -248,7 +263,7 @@ public class Inbox extends SubCommand {
248
263
  if (!comments.isEmpty()) {
249
264
  player.sendMessage(
250
265
  TranslatableCaption.of("comment.comment_removed_success"),
251
- Template.of("value", String.valueOf(comments))
266
+ TagResolver.resolver("value", Tag.inserting(Component.text("*")))
252
267
  );
253
268
  plot.getPlotCommentContainer().removeComments(comments);
254
269
  }
Core/src/main/java/com/plotsquared/core/command/Info.java CHANGED
@@ -28,7 +28,9 @@ import com.plotsquared.core.player.PlotPlayer;
28
28
  import com.plotsquared.core.plot.Plot;
29
29
  import com.plotsquared.core.plot.flag.implementations.HideInfoFlag;
30
30
  import com.plotsquared.core.util.TabCompletions;
31
- import net.kyori.adventure.text.minimessage.Template;
31
+ import net.kyori.adventure.text.Component;
32
+ import net.kyori.adventure.text.minimessage.tag.Tag;
33
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
32
34
 
33
35
  import java.util.Collection;
34
36
  import java.util.Collections;
@@ -90,7 +92,10 @@ public class Info extends SubCommand {
90
92
  .hasPermission(Permission.PERMISSION_AREA_INFO_FORCE.toString())) {
91
93
  player.sendMessage(
92
94
  TranslatableCaption.of("permission.no_permission"),
93
- Template.of("node", Permission.PERMISSION_AREA_INFO_FORCE.toString())
95
+ TagResolver.resolver(
96
+ "node",
97
+ Tag.inserting(Permission.PERMISSION_AREA_INFO_FORCE)
98
+ )
94
99
  );
95
100
  return true;
96
101
  }
@@ -112,7 +117,10 @@ public class Info extends SubCommand {
112
117
  if (!hasOwner && !containsEveryone && !trustedEveryone) {
113
118
  player.sendMessage(
114
119
  TranslatableCaption.of("info.plot_info_unclaimed"),
115
- Template.of("plot", plot.getId().getX() + ";" + plot.getId().getY())
120
+ TagResolver.resolver(
121
+ "plot",
122
+ Tag.inserting(Component.text(plot.getId().getX() + ";" + plot.getId().getY()))
123
+ )
116
124
  );
117
125
  return true;
118
126
  }
Core/src/main/java/com/plotsquared/core/command/Kick.java CHANGED
@@ -30,7 +30,9 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
30
30
  import com.plotsquared.core.util.PlayerManager;
31
31
  import com.plotsquared.core.util.TabCompletions;
32
32
  import com.plotsquared.core.util.WorldUtil;
33
- import net.kyori.adventure.text.minimessage.Template;
33
+ import net.kyori.adventure.text.Component;
34
+ import net.kyori.adventure.text.minimessage.tag.Tag;
35
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
34
36
  import org.checkerframework.checker.nullness.qual.NonNull;
35
37
 
36
38
  import java.util.Collection;
@@ -80,7 +82,7 @@ public class Kick extends SubCommand {
80
82
  } else if (throwable != null || uuids.isEmpty()) {
81
83
  player.sendMessage(
82
84
  TranslatableCaption.of("errors.invalid_player"),
83
- Template.of("value", args[0])
85
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
84
86
  );
85
87
  } else {
86
88
  Set<PlotPlayer<?>> players = new HashSet<>();
@@ -103,7 +105,7 @@ public class Kick extends SubCommand {
103
105
  if (players.isEmpty()) {
104
106
  player.sendMessage(
105
107
  TranslatableCaption.of("errors.invalid_player"),
106
- Template.of("value", args[0])
108
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
107
109
  );
108
110
  return;
109
111
  }
@@ -111,14 +113,14 @@ public class Kick extends SubCommand {
111
113
  if (!plot.equals(player2.getCurrentPlot())) {
112
114
  player.sendMessage(
113
115
  TranslatableCaption.of("errors.invalid_player"),
114
- Template.of("value", args[0])
116
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
115
117
  );
116
118
  return;
117
119
  }
118
120
  if (player2.hasPermission(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) {
119
121
  player.sendMessage(
120
122
  TranslatableCaption.of("cluster.cannot_kick_player"),
121
- Template.of("name", player2.getName())
123
+ TagResolver.resolver("name", Tag.inserting(Component.text(player2.getName())))
122
124
  );
123
125
  return;
124
126
  }
Core/src/main/java/com/plotsquared/core/command/Leave.java CHANGED
@@ -25,7 +25,9 @@ import com.plotsquared.core.plot.Plot;
25
25
  import com.plotsquared.core.util.EventDispatcher;
26
26
  import com.plotsquared.core.util.task.RunnableVal2;
27
27
  import com.plotsquared.core.util.task.RunnableVal3;
28
- import net.kyori.adventure.text.minimessage.Template;
28
+ import net.kyori.adventure.text.Component;
29
+ import net.kyori.adventure.text.minimessage.tag.Tag;
30
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
29
31
  import org.checkerframework.checker.nullness.qual.NonNull;
30
32
 
31
33
  import java.util.UUID;
@@ -67,7 +69,7 @@ public class Leave extends Command {
67
69
  }
68
70
  player.sendMessage(
69
71
  TranslatableCaption.of("member.plot_left"),
70
- Template.of("player", player.getName())
72
+ TagResolver.resolver("player", Tag.inserting(Component.text(player.getName())))
71
73
  );
72
74
  } else {
73
75
  player.sendMessage(
Core/src/main/java/com/plotsquared/core/command/Like.java CHANGED
@@ -33,7 +33,9 @@ import com.plotsquared.core.util.EventDispatcher;
33
33
  import com.plotsquared.core.util.TabCompletions;
34
34
  import com.plotsquared.core.util.query.PlotQuery;
35
35
  import com.plotsquared.core.util.task.TaskManager;
36
- import net.kyori.adventure.text.minimessage.Template;
36
+ import net.kyori.adventure.text.Component;
37
+ import net.kyori.adventure.text.minimessage.tag.Tag;
38
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
37
39
  import org.checkerframework.checker.nullness.qual.NonNull;
38
40
 
39
41
  import java.util.Collection;
@@ -151,7 +153,7 @@ public class Like extends SubCommand {
151
153
  if (oldRating != null) {
152
154
  player.sendMessage(
153
155
  TranslatableCaption.of("ratings.rating_already_exists"),
154
- Template.of("plot", plot.getId().toString())
156
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
155
157
  );
156
158
  return;
157
159
  }
@@ -169,12 +171,12 @@ public class Like extends SubCommand {
169
171
  if (like) {
170
172
  player.sendMessage(
171
173
  TranslatableCaption.of("ratings.rating_liked"),
172
- Template.of("plot", plot.getId().toString())
174
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
173
175
  );
174
176
  } else {
175
177
  player.sendMessage(
176
178
  TranslatableCaption.of("ratings.rating_disliked"),
177
- Template.of("plot", plot.getId().toString())
179
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
178
180
  );
179
181
  }
180
182
  }
Core/src/main/java/com/plotsquared/core/command/ListCmd.java CHANGED
@@ -23,7 +23,6 @@ import com.plotsquared.core.PlotSquared;
23
23
  import com.plotsquared.core.configuration.Settings;
24
24
  import com.plotsquared.core.configuration.caption.Caption;
25
25
  import com.plotsquared.core.configuration.caption.CaptionHolder;
26
- import com.plotsquared.core.configuration.caption.Templates;
27
26
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
28
27
  import com.plotsquared.core.database.DBFunc;
29
28
  import com.plotsquared.core.permissions.Permission;
@@ -46,7 +45,8 @@ import com.plotsquared.core.util.task.RunnableVal3;
46
45
  import com.plotsquared.core.uuid.UUIDMapping;
47
46
  import net.kyori.adventure.text.Component;
48
47
  import net.kyori.adventure.text.TextComponent;
49
- import net.kyori.adventure.text.minimessage.Template;
48
+ import net.kyori.adventure.text.minimessage.tag.Tag;
49
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
50
50
  import org.checkerframework.checker.nullness.qual.NonNull;
51
51
 
52
52
  import java.util.ArrayList;
@@ -123,7 +123,7 @@ public class ListCmd extends SubCommand {
123
123
  public void noArgs(PlotPlayer<?> player) {
124
124
  player.sendMessage(
125
125
  TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
126
- Templates.of("values", Arrays.toString(getArgumentList(player)))
126
+ TagResolver.resolver("values", Tag.inserting(Component.text(Arrays.toString(getArgumentList(player)))))
127
127
  );
128
128
  }
129
129
 
@@ -159,9 +159,14 @@ public class ListCmd extends SubCommand {
159
159
  if (query == null) {
160
160
  player.sendMessage(
161
161
  TranslatableCaption.of("commandconfig.did_you_mean"),
162
- Template.of(
162
+ TagResolver.resolver(
163
163
  "value",
164
- new StringComparison<>(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch()
164
+ Tag.inserting(Component.text(
165
+ new StringComparison<>(
166
+ args[0],
167
+ new String[]{"mine", "shared", "world", "all"}
168
+ ).getBestMatch()
169
+ ))
165
170
  )
166
171
  );
167
172
  return;
@@ -189,7 +194,7 @@ public class ListCmd extends SubCommand {
189
194
  if (!player.hasPermission(Permission.PERMISSION_LIST_MINE)) {
190
195
  player.sendMessage(
191
196
  TranslatableCaption.of("permission.no_permission"),
192
- Templates.of("node", "plots.list.mine")
197
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.mine")))
193
198
  );
194
199
  return false;
195
200
  }
@@ -204,7 +209,7 @@ public class ListCmd extends SubCommand {
204
209
  if (!player.hasPermission(Permission.PERMISSION_LIST_SHARED)) {
205
210
  player.sendMessage(
206
211
  TranslatableCaption.of("permission.no_permission"),
207
- Templates.of("node", "plots.list.shared")
212
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.shared")))
208
213
  );
209
214
  return false;
210
215
  }
@@ -217,14 +222,14 @@ public class ListCmd extends SubCommand {
217
222
  if (!player.hasPermission(Permission.PERMISSION_LIST_WORLD)) {
218
223
  player.sendMessage(
219
224
  TranslatableCaption.of("permission.no_permission"),
220
- Templates.of("node", "plots.list.world")
225
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world")))
221
226
  );
222
227
  return false;
223
228
  }
224
229
  if (!player.hasPermission("plots.list.world." + world)) {
225
230
  player.sendMessage(
226
231
  TranslatableCaption.of("permission.no_permission"),
227
- Templates.of("node", "plots.list.world." + world)
232
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world)))
228
233
  );
229
234
  return false;
230
235
  }
@@ -234,7 +239,7 @@ public class ListCmd extends SubCommand {
234
239
  if (!player.hasPermission(Permission.PERMISSION_LIST_EXPIRED)) {
235
240
  player.sendMessage(
236
241
  TranslatableCaption.of("permission.no_permission"),
237
- Templates.of("node", "plots.list.expired")
242
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.expired")))
238
243
  );
239
244
  return false;
240
245
  }
@@ -248,14 +253,14 @@ public class ListCmd extends SubCommand {
248
253
  if (!player.hasPermission(Permission.PERMISSION_LIST_AREA)) {
249
254
  player.sendMessage(
250
255
  TranslatableCaption.of("permission.no_permission"),
251
- Templates.of("node", "plots.list.area")
256
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.area")))
252
257
  );
253
258
  return false;
254
259
  }
255
260
  if (!player.hasPermission("plots.list.world." + world)) {
256
261
  player.sendMessage(
257
262
  TranslatableCaption.of("permission.no_permission"),
258
- Templates.of("node", "plots.list.world." + world)
263
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world)))
259
264
  );
260
265
  return false;
261
266
  }
@@ -269,7 +274,7 @@ public class ListCmd extends SubCommand {
269
274
  if (!player.hasPermission(Permission.PERMISSION_LIST_ALL)) {
270
275
  player.sendMessage(
271
276
  TranslatableCaption.of("permission.no_permission"),
272
- Templates.of("node", "plots.list.all")
277
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.all")))
273
278
  );
274
279
  return false;
275
280
  }
@@ -279,7 +284,7 @@ public class ListCmd extends SubCommand {
279
284
  if (!player.hasPermission(Permission.PERMISSION_LIST_DONE)) {
280
285
  player.sendMessage(
281
286
  TranslatableCaption.of("permission.no_permission"),
282
- Templates.of("node", "plots.list.done")
287
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.done")))
283
288
  );
284
289
  return false;
285
290
  }
@@ -294,7 +299,7 @@ public class ListCmd extends SubCommand {
294
299
  if (!player.hasPermission(Permission.PERMISSION_LIST_TOP)) {
295
300
  player.sendMessage(
296
301
  TranslatableCaption.of("permission.no_permission"),
297
- Templates.of("node", "plots.list.top")
302
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.top")))
298
303
  );
299
304
  return false;
300
305
  }
@@ -305,7 +310,7 @@ public class ListCmd extends SubCommand {
305
310
  if (!player.hasPermission(Permission.PERMISSION_LIST_FOR_SALE)) {
306
311
  player.sendMessage(
307
312
  TranslatableCaption.of("permission.no_permission"),
308
- Templates.of("node", "plots.list.forsale")
313
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.forsale")))
309
314
  );
310
315
  return false;
311
316
  }
@@ -318,7 +323,7 @@ public class ListCmd extends SubCommand {
318
323
  if (!player.hasPermission(Permission.PERMISSION_LIST_UNOWNED)) {
319
324
  player.sendMessage(
320
325
  TranslatableCaption.of("permission.no_permission"),
321
- Templates.of("node", "plots.list.unowned")
326
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.unowned")))
322
327
  );
323
328
  return false;
324
329
  }
@@ -328,14 +333,14 @@ public class ListCmd extends SubCommand {
328
333
  if (!player.hasPermission(Permission.PERMISSION_LIST_FUZZY)) {
329
334
  player.sendMessage(
330
335
  TranslatableCaption.of("permission.no_permission"),
331
- Templates.of("node", "plots.list.fuzzy")
336
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.fuzzy")))
332
337
  );
333
338
  return false;
334
339
  }
335
340
  if (args.length < (page == -1 ? 2 : 3)) {
336
341
  player.sendMessage(
337
342
  TranslatableCaption.of("commandconfig.command_syntax"),
338
- Templates.of("value", "/plot list fuzzy <search...> [#]")
343
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot list fuzzy <search...> [#]")))
339
344
  );
340
345
  return false;
341
346
  }
@@ -353,14 +358,14 @@ public class ListCmd extends SubCommand {
353
358
  if (!player.hasPermission(Permission.PERMISSION_LIST_WORLD)) {
354
359
  player.sendMessage(
355
360
  TranslatableCaption.of("permission.no_permission"),
356
- Templates.of("node", "plots.list.world")
361
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world")))
357
362
  );
358
363
  return false;
359
364
  }
360
365
  if (!player.hasPermission("plots.list.world." + args[0])) {
361
366
  player.sendMessage(
362
367
  TranslatableCaption.of("permission.no_permission"),
363
- Templates.of("node", "plots.list.world." + args[0])
368
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + args[0])))
364
369
  );
365
370
  return false;
366
371
  }
@@ -379,12 +384,15 @@ public class ListCmd extends SubCommand {
379
384
  }
380
385
  }
381
386
  if (uuid == null) {
382
- player.sendMessage(TranslatableCaption.of("errors.invalid_player"), Templates.of("value", args[0]));
387
+ player.sendMessage(
388
+ TranslatableCaption.of("errors.invalid_player"),
389
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
390
+ );
383
391
  } else {
384
392
  if (!player.hasPermission(Permission.PERMISSION_LIST_PLAYER)) {
385
393
  player.sendMessage(
386
394
  TranslatableCaption.of("permission.no_permission"),
387
- Templates.of("node", "plots.list.player")
395
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.player")))
388
396
  );
389
397
  } else {
390
398
  sort[0] = false;
@@ -420,32 +428,34 @@ public class ListCmd extends SubCommand {
420
428
  } else {
421
429
  color = TranslatableCaption.of("info.plot_list_default");
422
430
  }
423
- Component trusted = MINI_MESSAGE.parse(
431
+ Component trusted = MINI_MESSAGE.deserialize(
424
432
  TranslatableCaption.of("info.plot_info_trusted").getComponent(player),
425
- Template.of("trusted", PlayerManager.getPlayerList(plot.getTrusted(), player))
433
+ TagResolver.resolver("trusted", Tag.inserting(PlayerManager.getPlayerList(plot.getTrusted(), player)))
426
434
  );
427
- Component members = MINI_MESSAGE.parse(
435
+ Component members = MINI_MESSAGE.deserialize(
428
436
  TranslatableCaption.of("info.plot_info_members").getComponent(player),
429
- Template.of("members", PlayerManager.getPlayerList(plot.getMembers(), player))
437
+ TagResolver.resolver("members", Tag.inserting(PlayerManager.getPlayerList(plot.getMembers(), player)))
430
438
  );
431
- Template command_tp = Template.of("command_tp", "/plot visit " + plot.getArea() + ";" + plot.getId());
432
- Template command_info = Template.of("command_info", "/plot info " + plot.getArea() + ";" + plot.getId());
433
- Template hover_info =
434
- Template.of(
435
- "hover_info",
436
- MINI_MESSAGE.serialize(Component
437
- .text()
438
- .append(trusted)
439
- .append(Component.newline())
440
- .append(members)
441
- .asComponent())
442
- );
443
- Template numberTemplate = Template.of("number", String.valueOf(i));
444
- Template plotTemplate = Template.of(
445
- "plot",
446
- MINI_MESSAGE.parse(color.getComponent(player), Template.of("plot", plot.toString()))
439
+ TagResolver.Builder finalResolver = TagResolver.builder();
440
+ finalResolver.tag(
441
+ "command_tp",
442
+ Tag.preProcessParsed("/plot visit " + plot.getArea() + ";" + plot.getId())
447
443
  );
448
-
444
+ finalResolver.tag(
445
+ "command_info",
446
+ Tag.preProcessParsed("/plot info " + plot.getArea() + ";" + plot.getId())
447
+ );
448
+ finalResolver.tag("hover_info", Tag.inserting(
449
+ Component.text()
450
+ .append(trusted)
451
+ .append(Component.newline())
452
+ .append(members)
453
+ .asComponent()
454
+ ));
455
+ finalResolver.tag("number", Tag.inserting(Component.text(i)));
456
+ finalResolver.tag("plot", Tag.inserting(MINI_MESSAGE.deserialize(
457
+ color.getComponent(player), TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
458
+ )));
449
459
  String prefix = "";
450
460
  String online = TranslatableCaption.of("info.plot_list_player_online").getComponent(player);
451
461
  String offline = TranslatableCaption.of("info.plot_list_player_offline").getComponent(player);
@@ -454,35 +464,37 @@ public class ListCmd extends SubCommand {
454
464
  String everyone = TranslatableCaption.of("info.plot_list_player_everyone").getComponent(player);
455
465
  TextComponent.Builder builder = Component.text();
456
466
  if (plot.getFlag(ServerPlotFlag.class)) {
457
- Template serverTemplate = Template.of(
467
+ TagResolver serverResolver = TagResolver.resolver(
458
468
  "info.server",
459
- TranslatableCaption.of("info.server").getComponent(player)
469
+ Tag.inserting(TranslatableCaption.of("info.server").toComponent(player))
460
470
  );
461
- builder.append(MINI_MESSAGE.parse(server, serverTemplate));
471
+ builder.append(MINI_MESSAGE.deserialize(server, serverResolver));
462
472
  } else {
463
473
  try {
464
474
  final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
465
475
  .get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
466
476
  for (final UUIDMapping uuidMapping : names) {
467
477
  PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.getUuid());
468
- Template prefixTemplate = Template.of("prefix", prefix);
469
- Template playerTemplate = Template.of("player", uuidMapping.getUsername());
470
- if (pp != null) {
471
- builder.append(MINI_MESSAGE.parse(online, prefixTemplate, playerTemplate));
478
+ TagResolver resolver = TagResolver.builder()
479
+ .tag("prefix", Tag.inserting(Component.text(prefix)))
480
+ .tag("player", Tag.inserting(Component.text(uuidMapping.getUsername())))
481
+ .build();
482
+ if (pp != null) {
483
+ builder.append(MINI_MESSAGE.deserialize(online, resolver));
472
484
  } else if (uuidMapping.getUsername().equalsIgnoreCase("unknown")) {
473
- Template unknownTemplate = Template.of(
485
+ TagResolver unknownResolver = TagResolver.resolver(
474
486
  "info.unknown",
475
- TranslatableCaption.of("info.unknown").getComponent(player)
487
+ Tag.inserting(TranslatableCaption.of("info.unknown").toComponent(player))
476
488
  );
477
- builder.append(MINI_MESSAGE.parse(unknown, unknownTemplate));
489
+ builder.append(MINI_MESSAGE.deserialize(unknown, unknownResolver));
478
490
  } else if (uuidMapping.getUuid().equals(DBFunc.EVERYONE)) {
479
- Template everyoneTemplate = Template.of(
491
+ TagResolver everyoneResolver = TagResolver.resolver(
480
492
  "info.everyone",
481
- TranslatableCaption.of("info.everyone").getComponent(player)
493
+ Tag.inserting(TranslatableCaption.of("info.everyone").toComponent(player))
482
494
  );
483
- builder.append(MINI_MESSAGE.parse(everyone, everyoneTemplate));
495
+ builder.append(MINI_MESSAGE.deserialize(everyone, everyoneResolver));
484
496
  } else {
485
- builder.append(MINI_MESSAGE.parse(offline, prefixTemplate, playerTemplate));
497
+ builder.append(MINI_MESSAGE.deserialize(offline, resolver));
486
498
  }
487
499
  prefix = ", ";
488
500
  }
@@ -498,15 +510,15 @@ public class ListCmd extends SubCommand {
498
510
  }
499
511
  player.sendMessage(
500
512
  TranslatableCaption.of("errors.invalid_player"),
501
- Templates.of("value", playerBuilder.toString())
513
+ TagResolver.resolver("value", Tag.inserting(Component.text(playerBuilder.toString())))
502
514
  );
503
515
  } catch (TimeoutException e) {
504
516
  player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
505
517
  }
506
518
  }
507
- Template players = Template.of("players", builder.asComponent());
519
+ finalResolver.tag("players", Tag.inserting(builder.asComponent()));
508
520
  caption.set(TranslatableCaption.of("info.plot_list_item"));
509
- caption.setTemplates(command_tp, command_info, hover_info, numberTemplate, plotTemplate, players);
521
+ caption.setTagResolvers(finalResolver.build());
510
522
  }
511
523
  }, "/plot list " + args[0], TranslatableCaption.of("list.plot_list_header_paged"));
512
524
  }
Core/src/main/java/com/plotsquared/core/command/Load.java CHANGED
@@ -35,7 +35,9 @@ import com.plotsquared.core.util.SchematicHandler;
35
35
  import com.plotsquared.core.util.TimeUtil;
36
36
  import com.plotsquared.core.util.task.RunnableVal;
37
37
  import com.plotsquared.core.util.task.TaskManager;
38
- import net.kyori.adventure.text.minimessage.Template;
38
+ import net.kyori.adventure.text.Component;
39
+ import net.kyori.adventure.text.minimessage.tag.Tag;
40
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
39
41
  import org.checkerframework.checker.nullness.qual.NonNull;
40
42
 
41
43
  import java.net.MalformedURLException;
@@ -97,7 +99,7 @@ public class Load extends SubCommand {
97
99
  // No schematics found:
98
100
  player.sendMessage(
99
101
  TranslatableCaption.of("web.load_null"),
100
- Template.of("command", "/plot load")
102
+ TagResolver.resolver("command", Tag.inserting(Component.text("/plot load")))
101
103
  );
102
104
  return false;
103
105
  }
@@ -108,7 +110,7 @@ public class Load extends SubCommand {
108
110
  // use /plot load <index>
109
111
  player.sendMessage(
110
112
  TranslatableCaption.of("invalid.not_valid_number"),
111
- Template.of("value", "(1, " + schematics.size() + ')')
113
+ TagResolver.resolver("value", Tag.inserting(Component.text("(1, " + schematics.size() + ')')))
112
114
  );
113
115
  return false;
114
116
  }
@@ -128,7 +130,10 @@ public class Load extends SubCommand {
128
130
  plot.removeRunning();
129
131
  player.sendMessage(
130
132
  TranslatableCaption.of("schematics.schematic_invalid"),
131
- Template.of("reason", "non-existent or not in gzip format")
133
+ TagResolver.resolver(
134
+ "reason",
135
+ Tag.inserting(Component.text("non-existent or not in gzip format"))
136
+ )
132
137
  );
133
138
  return;
134
139
  }
@@ -159,7 +164,7 @@ public class Load extends SubCommand {
159
164
  plot.removeRunning();
160
165
  player.sendMessage(
161
166
  TranslatableCaption.of("commandconfig.command_syntax"),
162
- Template.of("value", "/plot load <index>")
167
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot load <index>")))
163
168
  );
164
169
  return false;
165
170
  }
@@ -210,46 +215,9 @@ public class Load extends SubCommand {
210
215
  }
211
216
  player.sendMessage(
212
217
  TranslatableCaption.of("web.load_list"),
213
- Template.of("command", "/plot load #")
218
+ TagResolver.resolver("command", Tag.inserting(Component.text("/plot load #")))
214
219
  );
215
220
  }
216
221
  }
217
222
 
218
- /**
219
- * @deprecated Use {@link TimeUtil#secToTime(long)}
220
- */
221
- @Deprecated(forRemoval = true, since = "6.6.2")
222
- public String secToTime(long time) {
223
- StringBuilder toreturn = new StringBuilder();
224
- if (time >= 33868800) {
225
- int years = (int) (time / 33868800);
226
- time -= years * 33868800;
227
- toreturn.append(years).append("y ");
228
- }
229
- if (time >= 604800) {
230
- int weeks = (int) (time / 604800);
231
- time -= weeks * 604800;
232
- toreturn.append(weeks).append("w ");
233
- }
234
- if (time >= 86400) {
235
- int days = (int) (time / 86400);
236
- time -= days * 86400;
237
- toreturn.append(days).append("d ");
238
- }
239
- if (time >= 3600) {
240
- int hours = (int) (time / 3600);
241
- time -= hours * 3600;
242
- toreturn.append(hours).append("h ");
243
- }
244
- if (time >= 60) {
245
- int minutes = (int) (time / 60);
246
- time -= minutes * 60;
247
- toreturn.append(minutes).append("m ");
248
- }
249
- if (toreturn.length() == 0 || (time > 0)) {
250
- toreturn.append(time).append("s ");
251
- }
252
- return toreturn.toString().trim();
253
- }
254
-
255
223
  }
Core/src/main/java/com/plotsquared/core/command/MainCommand.java CHANGED
@@ -35,6 +35,9 @@ import com.plotsquared.core.util.EconHandler;
35
35
  import com.plotsquared.core.util.PlotExpression;
36
36
  import com.plotsquared.core.util.task.RunnableVal2;
37
37
  import com.plotsquared.core.util.task.RunnableVal3;
38
+ import net.kyori.adventure.text.Component;
39
+ import net.kyori.adventure.text.minimessage.tag.Tag;
40
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
38
41
  import org.apache.logging.log4j.LogManager;
39
42
  import org.apache.logging.log4j.Logger;
40
43
 
@@ -71,7 +74,6 @@ public class MainCommand extends Command {
71
74
  commands.add(Buy.class);
72
75
  if (Settings.Web.LEGACY_WEBINTERFACE) {
73
76
  LOGGER.warn("Legacy webinterface is used. Please note that it will be removed in future.");
74
- commands.add(Save.class);
75
77
  }
76
78
  commands.add(Load.class);
77
79
  commands.add(Confirm.class);
@@ -120,7 +122,6 @@ public class MainCommand extends Command {
120
122
  commands.add(Move.class);
121
123
  commands.add(Condense.class);
122
124
  commands.add(Copy.class);
123
- commands.add(Chat.class);
124
125
  commands.add(Trim.class);
125
126
  commands.add(Done.class);
126
127
  commands.add(Continue.class);
@@ -310,7 +311,7 @@ public class MainCommand extends Command {
310
311
  if (message != null) {
311
312
  player.sendMessage(
312
313
  TranslatableCaption.of("errors.error"),
313
- net.kyori.adventure.text.minimessage.Template.of("value", message)
314
+ TagResolver.resolver("value", Tag.inserting(Component.text(message)))
314
315
  );
315
316
  } else {
316
317
  player.sendMessage(
Core/src/main/java/com/plotsquared/core/command/Merge.java CHANGED
@@ -34,7 +34,9 @@ import com.plotsquared.core.util.EconHandler;
34
34
  import com.plotsquared.core.util.EventDispatcher;
35
35
  import com.plotsquared.core.util.PlotExpression;
36
36
  import com.plotsquared.core.util.StringMan;
37
- import net.kyori.adventure.text.minimessage.Template;
37
+ import net.kyori.adventure.text.Component;
38
+ import net.kyori.adventure.text.minimessage.tag.Tag;
39
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
38
40
  import org.checkerframework.checker.nullness.qual.NonNull;
39
41
 
40
42
  import java.util.UUID;
@@ -114,11 +116,13 @@ public class Merge extends SubCommand {
114
116
  if (direction == null) {
115
117
  player.sendMessage(
116
118
  TranslatableCaption.of("commandconfig.command_syntax"),
117
- Template.of("value", "/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]")
119
+ TagResolver.resolver("value", Tag.inserting(Component.text(
120
+ "/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]"
121
+ )))
118
122
  );
119
123
  player.sendMessage(
120
124
  TranslatableCaption.of("help.direction"),
121
- Template.of("dir", direction(location.getYaw()))
125
+ TagResolver.resolver("dir", Tag.inserting(Component.text(direction(location.getYaw()))))
122
126
  );
123
127
  return false;
124
128
  }
@@ -129,7 +133,7 @@ public class Merge extends SubCommand {
129
133
  if (event.getEventResult() == Result.DENY) {
130
134
  player.sendMessage(
131
135
  TranslatableCaption.of("events.event_denied"),
132
- Template.of("value", "Merge")
136
+ TagResolver.resolver("value", Tag.inserting(Component.text("Merge")))
133
137
  );
134
138
  return false;
135
139
  }
@@ -140,7 +144,7 @@ public class Merge extends SubCommand {
140
144
  if (!force && size - 1 > maxSize) {
141
145
  player.sendMessage(
142
146
  TranslatableCaption.of("permission.no_permission"),
143
- Template.of("node", Permission.PERMISSION_MERGE + "." + (size + 1))
147
+ TagResolver.resolver("node", Tag.inserting(Component.text(Permission.PERMISSION_MERGE + "." + (size + 1))))
144
148
  );
145
149
  return false;
146
150
  }
@@ -166,7 +170,10 @@ public class Merge extends SubCommand {
166
170
  if (!force && !terrain && !player.hasPermission(Permission.PERMISSION_MERGE_KEEP_ROAD)) {
167
171
  player.sendMessage(
168
172
  TranslatableCaption.of("permission.no_permission"),
169
- Template.of("node", String.valueOf(Permission.PERMISSION_MERGE_KEEP_ROAD))
173
+ TagResolver.resolver(
174
+ "node",
175
+ Tag.inserting(Permission.PERMISSION_MERGE_KEEP_ROAD)
176
+ )
170
177
  );
171
178
  return true;
172
179
  }
@@ -175,8 +182,11 @@ public class Merge extends SubCommand {
175
182
  this.econHandler.withdrawMoney(player, price);
176
183
  player.sendMessage(
177
184
  TranslatableCaption.of("economy.removed_balance"),
178
- Template.of("money", this.econHandler.format(price)),
179
- Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
185
+ TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price)))),
186
+ TagResolver.resolver(
187
+ "balance",
188
+ Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(player))))
189
+ )
180
190
  );
181
191
  }
182
192
  player.sendMessage(TranslatableCaption.of("merge.success_merge"));
@@ -190,7 +200,7 @@ public class Merge extends SubCommand {
190
200
  && this.econHandler.getMoney(player) < price) {
191
201
  player.sendMessage(
192
202
  TranslatableCaption.of("economy.cannot_afford_merge"),
193
- Template.of("money", this.econHandler.format(price))
203
+ TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
194
204
  );
195
205
  return false;
196
206
  }
@@ -203,7 +213,7 @@ public class Merge extends SubCommand {
203
213
  if (!force && !terrain && !player.hasPermission(Permission.PERMISSION_MERGE_KEEP_ROAD)) {
204
214
  player.sendMessage(
205
215
  TranslatableCaption.of("permission.no_permission"),
206
- Template.of("node", String.valueOf(Permission.PERMISSION_MERGE_KEEP_ROAD))
216
+ TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_MERGE_KEEP_ROAD))
207
217
  );
208
218
  return true;
209
219
  }
@@ -212,7 +222,7 @@ public class Merge extends SubCommand {
212
222
  this.econHandler.withdrawMoney(player, price);
213
223
  player.sendMessage(
214
224
  TranslatableCaption.of("economy.removed_balance"),
215
- Template.of("money", this.econHandler.format(price))
225
+ TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
216
226
  );
217
227
  }
218
228
  player.sendMessage(TranslatableCaption.of("merge.success_merge"));
@@ -228,7 +238,7 @@ public class Merge extends SubCommand {
228
238
  if (!force && !player.hasPermission(Permission.PERMISSION_MERGE_OTHER)) {
229
239
  player.sendMessage(
230
240
  TranslatableCaption.of("permission.no_permission"),
231
- Template.of("node", String.valueOf(Permission.PERMISSION_MERGE_OTHER))
241
+ TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_MERGE_OTHER))
232
242
  );
233
243
  return false;
234
244
  }
@@ -253,14 +263,14 @@ public class Merge extends SubCommand {
253
263
  if (!force && this.econHandler.getMoney(player) < price) {
254
264
  player.sendMessage(
255
265
  TranslatableCaption.of("economy.cannot_afford_merge"),
256
- Template.of("money", this.econHandler.format(price))
266
+ TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
257
267
  );
258
268
  return;
259
269
  }
260
270
  this.econHandler.withdrawMoney(player, price);
261
271
  player.sendMessage(
262
272
  TranslatableCaption.of("economy.removed_balance"),
263
- Template.of("money", this.econHandler.format(price))
273
+ TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
264
274
  );
265
275
  }
266
276
  player.sendMessage(TranslatableCaption.of("merge.success_merge"));
@@ -268,10 +278,15 @@ public class Merge extends SubCommand {
268
278
  };
269
279
  if (!force && hasConfirmation(player)) {
270
280
  CmdConfirm.addPending(accepter, MINI_MESSAGE.serialize(MINI_MESSAGE
271
- .parse(
281
+ .deserialize(
272
282
  TranslatableCaption.of("merge.merge_request_confirm").getComponent(player),
273
- Template.of("player", player.getName()),
274
- Template.of("location", plot.getWorldName() + ";" + plot.getId())
283
+ TagResolver.builder()
284
+ .tag("player", Tag.inserting(Component.text(player.getName())))
285
+ .tag(
286
+ "location",
287
+ Tag.inserting(Component.text(plot.getWorldName() + " " + plot.getId()))
288
+ )
289
+ .build()
275
290
  )),
276
291
  run
277
292
  );
@@ -292,14 +307,14 @@ public class Merge extends SubCommand {
292
307
  if (!force && this.econHandler.getMoney(player) < price) {
293
308
  player.sendMessage(
294
309
  TranslatableCaption.of("economy.cannot_afford_merge"),
295
- Template.of("money", this.econHandler.format(price))
310
+ TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
296
311
  );
297
312
  return false;
298
313
  }
299
314
  this.econHandler.withdrawMoney(player, price);
300
315
  player.sendMessage(
301
316
  TranslatableCaption.of("economy.removed_balance"),
302
- Template.of("money", this.econHandler.format(price))
317
+ TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
303
318
  );
304
319
  }
305
320
  player.sendMessage(TranslatableCaption.of("merge.success_merge"));
Core/src/main/java/com/plotsquared/core/command/Move.java CHANGED
@@ -28,7 +28,9 @@ import com.plotsquared.core.plot.PlotArea;
28
28
  import com.plotsquared.core.plot.world.PlotAreaManager;
29
29
  import com.plotsquared.core.util.task.RunnableVal2;
30
30
  import com.plotsquared.core.util.task.RunnableVal3;
31
- import net.kyori.adventure.text.minimessage.Template;
31
+ import net.kyori.adventure.text.Component;
32
+ import net.kyori.adventure.text.minimessage.tag.Tag;
33
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
32
34
  import org.checkerframework.checker.nullness.qual.NonNull;
33
35
 
34
36
  import java.util.concurrent.CompletableFuture;
@@ -104,8 +106,10 @@ public class Move extends SubCommand {
104
106
  if (result) {
105
107
  player.sendMessage(
106
108
  TranslatableCaption.of("move.move_success"),
107
- Template.of("origin", p1),
108
- Template.of("target", p2)
109
+ TagResolver.builder()
110
+ .tag("origin", Tag.inserting(Component.text(p1)))
111
+ .tag("target", Tag.inserting(Component.text(p2)))
112
+ .build()
109
113
  );
110
114
  return true;
111
115
  } else {
Core/src/main/java/com/plotsquared/core/command/Music.java CHANGED
@@ -35,7 +35,9 @@ import com.plotsquared.core.util.EventDispatcher;
35
35
  import com.plotsquared.core.util.InventoryUtil;
36
36
  import com.sk89q.worldedit.world.item.ItemType;
37
37
  import com.sk89q.worldedit.world.item.ItemTypes;
38
- import net.kyori.adventure.text.minimessage.Template;
38
+ import net.kyori.adventure.text.Component;
39
+ import net.kyori.adventure.text.minimessage.tag.Tag;
40
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
39
41
  import org.checkerframework.checker.nullness.qual.NonNull;
40
42
 
41
43
  import javax.annotation.Nullable;
@@ -81,7 +83,10 @@ public class Music extends SubCommand {
81
83
  if (!plot.isAdded(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_MUSIC_OTHER)) {
82
84
  player.sendMessage(
83
85
  TranslatableCaption.of("permission.no_permission"),
84
- Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_MUSIC_OTHER))
86
+ TagResolver.resolver(
87
+ "node",
88
+ Tag.inserting(Permission.PERMISSION_ADMIN_MUSIC_OTHER)
89
+ )
85
90
  );
86
91
  return true;
87
92
  }
@@ -104,15 +109,17 @@ public class Music extends SubCommand {
104
109
  if (event.getEventResult() == Result.DENY) {
105
110
  getPlayer().sendMessage(
106
111
  TranslatableCaption.of("events.event_denied"),
107
- Template.of("value", "Music removal")
112
+ TagResolver.resolver("value", Tag.inserting(Component.text("Music removal")))
108
113
  );
109
114
  return true;
110
115
  }
111
116
  plot.removeFlag(event.getFlag());
112
117
  getPlayer().sendMessage(
113
118
  TranslatableCaption.of("flag.flag_removed"),
114
- Template.of("flag", "music"),
115
- Template.of("value", "music_disc")
119
+ TagResolver.builder()
120
+ .tag("flag", Tag.inserting(Component.text("music")))
121
+ .tag("value", Tag.inserting(Component.text("music_disc")))
122
+ .build()
116
123
  );
117
124
  } else if (item.getName().toLowerCase(Locale.ENGLISH).contains("disc")) {
118
125
  PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class)
@@ -121,13 +128,17 @@ public class Music extends SubCommand {
121
128
  if (event.getEventResult() == Result.DENY) {
122
129
  getPlayer().sendMessage(
123
130
  TranslatableCaption.of("events.event_denied"),
124
- Template.of("value", "Music addition")
131
+ TagResolver.resolver("value", Tag.inserting(Component.text("Music addition")))
125
132
  );
126
133
  return true;
127
134
  }
128
135
  plot.setFlag(event.getFlag());
129
- getPlayer().sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", "music"),
130
- Template.of("value", String.valueOf(event.getFlag().getValue()))
136
+ getPlayer().sendMessage(
137
+ TranslatableCaption.of("flag.flag_added"),
138
+ TagResolver.builder()
139
+ .tag("flag", Tag.inserting(Component.text("music")))
140
+ .tag("value", Tag.inserting(Component.text(event.getFlag().getValue().toString())))
141
+ .build()
131
142
  );
132
143
  } else {
133
144
  getPlayer().sendMessage(TranslatableCaption.of("flag.flag_not_added"));
Core/src/main/java/com/plotsquared/core/command/Near.java CHANGED
@@ -24,7 +24,9 @@ import com.plotsquared.core.plot.Plot;
24
24
  import com.plotsquared.core.util.StringMan;
25
25
  import com.plotsquared.core.util.task.RunnableVal2;
26
26
  import com.plotsquared.core.util.task.RunnableVal3;
27
- import net.kyori.adventure.text.minimessage.Template;
27
+ import net.kyori.adventure.text.Component;
28
+ import net.kyori.adventure.text.minimessage.tag.Tag;
29
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
28
30
 
29
31
  import java.util.List;
30
32
  import java.util.concurrent.CompletableFuture;
@@ -49,7 +51,7 @@ public class Near extends Command {
49
51
  final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
50
52
  player.sendMessage(
51
53
  TranslatableCaption.of("near.plot_near"),
52
- Template.of("list", StringMan.join(getPlayersInPlotVisible(plot, player), ", "))
54
+ TagResolver.resolver("list", Tag.inserting(Component.text(StringMan.join(plot.getPlayersInPlot(), ", "))))
53
55
  );
54
56
  return CompletableFuture.completedFuture(true);
55
57
  }
Core/src/main/java/com/plotsquared/core/command/Owner.java CHANGED
@@ -34,7 +34,9 @@ import com.plotsquared.core.util.EventDispatcher;
34
34
  import com.plotsquared.core.util.PlayerManager;
35
35
  import com.plotsquared.core.util.TabCompletions;
36
36
  import com.plotsquared.core.util.task.TaskManager;
37
- import net.kyori.adventure.text.minimessage.Template;
37
+ import net.kyori.adventure.text.Component;
38
+ import net.kyori.adventure.text.minimessage.tag.Tag;
39
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
38
40
  import org.checkerframework.checker.nullness.qual.NonNull;
39
41
  import org.checkerframework.checker.nullness.qual.Nullable;
40
42
 
@@ -65,7 +67,7 @@ public class Owner extends SetCommand {
65
67
  if (value == null || value.isEmpty()) {
66
68
  player.sendMessage(
67
69
  TranslatableCaption.of("commandconfig.command_syntax"),
68
- Template.of("value", "/plot setowner <owner>")
70
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot setowner <owner>")))
69
71
  );
70
72
  return false;
71
73
  }
@@ -77,7 +79,7 @@ public class Owner extends SetCommand {
77
79
  && !value.equalsIgnoreCase("-")) {
78
80
  player.sendMessage(
79
81
  TranslatableCaption.of("errors.invalid_player"),
80
- Template.of("value", value)
82
+ TagResolver.resolver("value", Tag.inserting(Component.text(value)))
81
83
  );
82
84
  return;
83
85
  }
@@ -91,7 +93,7 @@ public class Owner extends SetCommand {
91
93
  if (event.getEventResult() == Result.DENY) {
92
94
  player.sendMessage(
93
95
  TranslatableCaption.of("events.event_denied"),
94
- Template.of("value", "Owner change")
96
+ TagResolver.resolver("value", Tag.inserting(Component.text("Owner change")))
95
97
  );
96
98
  return;
97
99
  }
@@ -114,7 +116,7 @@ public class Owner extends SetCommand {
114
116
  if (unlinkEvent.getEventResult() == Result.DENY) {
115
117
  player.sendMessage(
116
118
  TranslatableCaption.of("events.event_denied"),
117
- Template.of("value", "Unlink on owner change")
119
+ TagResolver.resolver("value", Tag.inserting(Component.text("Unlink on owner change")))
118
120
  );
119
121
  return;
120
122
  }
@@ -134,7 +136,10 @@ public class Owner extends SetCommand {
134
136
  if (plot.isOwner(uuid)) {
135
137
  player.sendMessage(
136
138
  TranslatableCaption.of("member.already_owner"),
137
- Template.of("player", PlayerManager.resolveName(uuid, false).getComponent(player))
139
+ TagResolver.resolver(
140
+ "player",
141
+ Tag.inserting(PlayerManager.resolveName(uuid, false).toComponent(player))
142
+ )
138
143
  );
139
144
  return;
140
145
  }
@@ -142,7 +147,10 @@ public class Owner extends SetCommand {
142
147
  if (other == null) {
143
148
  player.sendMessage(
144
149
  TranslatableCaption.of("errors.invalid_player_offline"),
145
- Template.of("player", PlayerManager.resolveName(uuid).getComponent(player))
150
+ TagResolver.resolver(
151
+ "player",
152
+ Tag.inserting(PlayerManager.resolveName(uuid).toComponent(player))
153
+ )
146
154
  );
147
155
  return;
148
156
  }
@@ -178,7 +186,10 @@ public class Owner extends SetCommand {
178
186
  if (other != null) {
179
187
  other.sendMessage(
180
188
  TranslatableCaption.of("owner.now_owner"),
181
- Template.of("plot", plot.getArea() + ";" + plot.getId())
189
+ TagResolver.resolver(
190
+ "plot",
191
+ Tag.inserting(Component.text(plot.getArea() + ";" + plot.getId()))
192
+ )
182
193
  );
183
194
  }
184
195
  } else {
Core/src/main/java/com/plotsquared/core/command/PluginCmd.java CHANGED
@@ -23,7 +23,9 @@ import com.plotsquared.core.configuration.caption.StaticCaption;
23
23
  import com.plotsquared.core.player.PlotPlayer;
24
24
  import com.plotsquared.core.util.PremiumVerification;
25
25
  import com.plotsquared.core.util.task.TaskManager;
26
- import net.kyori.adventure.text.minimessage.Template;
26
+ import net.kyori.adventure.text.Component;
27
+ import net.kyori.adventure.text.minimessage.tag.Tag;
28
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
27
29
 
28
30
  @CommandDeclaration(command = "plugin",
29
31
  permission = "plots.use",
@@ -39,7 +41,7 @@ public class PluginCmd extends SubCommand {
39
41
  StaticCaption.of("<gray>>> </gray><gold><bold>" + PlotSquared
40
42
  .platform()
41
43
  .pluginName() + " <reset><gray>(<gold>Version</gold><gray>: </gray><gold><version></gold><gray>)</gray>"),
42
- Template.of("version", String.valueOf(PlotSquared.get().getVersion()))
44
+ TagResolver.resolver("version", Tag.inserting(Component.text(String.valueOf(PlotSquared.get().getVersion()))))
43
45
  );
44
46
  player.sendMessage(StaticCaption.of(
45
47
  "<gray>>> </gray><gold><bold>Authors<reset><gray>: </gray><gold>Citymonstret </gold><gray>& </gray><gold>Empire92 </gold><gray>& </gray><gold>MattBDev </gold><gray>& </gray><gold>dordsor21 </gold><gray>& </gray><gold>NotMyFault </gold><gray>& </gray><gold>SirYwell</gold>"));
@@ -49,7 +51,7 @@ public class PluginCmd extends SubCommand {
49
51
  "<gray>>> </gray><gold><bold>Discord<reset><gray>: </gray><gold><click:open_url:https://discord.gg/intellectualsites>https://discord.gg/intellectualsites</gold>"));
50
52
  player.sendMessage(
51
53
  StaticCaption.of("<gray>>> </gray><gold><bold>Premium<reset><gray>: <gold><value></gold>"),
52
- Template.of("value", String.valueOf(PremiumVerification.isPremium()))
54
+ TagResolver.resolver("value", Tag.inserting(Component.text(PremiumVerification.isPremium())))
53
55
  );
54
56
  });
55
57
  return true;
Core/src/main/java/com/plotsquared/core/command/Purge.java CHANGED
@@ -33,7 +33,9 @@ import com.plotsquared.core.util.StringMan;
33
33
  import com.plotsquared.core.util.query.PlotQuery;
34
34
  import com.plotsquared.core.util.task.TaskManager;
35
35
  import com.plotsquared.core.uuid.UUIDMapping;
36
- import net.kyori.adventure.text.minimessage.Template;
36
+ import net.kyori.adventure.text.Component;
37
+ import net.kyori.adventure.text.minimessage.tag.Tag;
38
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
37
39
  import org.apache.logging.log4j.LogManager;
38
40
  import org.apache.logging.log4j.Logger;
39
41
  import org.checkerframework.checker.nullness.qual.NonNull;
@@ -98,7 +100,7 @@ public class Purge extends SubCommand {
98
100
  if (area == null) {
99
101
  player.sendMessage(
100
102
  TranslatableCaption.of("errors.not_valid_plot_world"),
101
- Template.of("value", split[1])
103
+ TagResolver.resolver("value", Tag.inserting(Component.text(split[1])))
102
104
  );
103
105
  return false;
104
106
  }
@@ -110,7 +112,7 @@ public class Purge extends SubCommand {
110
112
  } catch (IllegalArgumentException ignored) {
111
113
  player.sendMessage(
112
114
  TranslatableCaption.of("invalid.not_valid_plot_id"),
113
- Template.of("value", split[1])
115
+ TagResolver.resolver("value", Tag.inserting(Component.text(split[1])))
114
116
  );
115
117
  return false;
116
118
  }
@@ -121,7 +123,7 @@ public class Purge extends SubCommand {
121
123
  if (ownerMapping == null) {
122
124
  player.sendMessage(
123
125
  TranslatableCaption.of("errors.invalid_player"),
124
- Template.of("value", split[1])
126
+ TagResolver.resolver("value", Tag.inserting(Component.text(split[1])))
125
127
  );
126
128
  return false;
127
129
  }
@@ -133,7 +135,7 @@ public class Purge extends SubCommand {
133
135
  if (addedMapping == null) {
134
136
  player.sendMessage(
135
137
  TranslatableCaption.of("errors.invalid_player"),
136
- Template.of("value", split[1])
138
+ TagResolver.resolver("value", Tag.inserting(Component.text(split[1])))
137
139
  );
138
140
  return false;
139
141
  }
@@ -258,7 +260,10 @@ public class Purge extends SubCommand {
258
260
  DBFunc.purgeIds(ids);
259
261
  player.sendMessage(
260
262
  TranslatableCaption.of("purge.purge_success"),
261
- Template.of("amount", ids.size() + "/" + toDelete.size())
263
+ TagResolver.resolver(
264
+ "amount",
265
+ Tag.inserting(Component.text(ids.size() + "/" + toDelete.size()))
266
+ )
262
267
  );
263
268
  });
264
269
  }
Core/src/main/java/com/plotsquared/core/command/Rate.java CHANGED
@@ -37,7 +37,9 @@ import com.plotsquared.core.util.MathMan;
37
37
  import com.plotsquared.core.util.TabCompletions;
38
38
  import com.plotsquared.core.util.query.PlotQuery;
39
39
  import com.plotsquared.core.util.task.TaskManager;
40
- import net.kyori.adventure.text.minimessage.Template;
40
+ import net.kyori.adventure.text.Component;
41
+ import net.kyori.adventure.text.minimessage.tag.Tag;
42
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
41
43
  import org.checkerframework.checker.nullness.qual.NonNull;
42
44
 
43
45
  import java.util.Collection;
@@ -146,7 +148,7 @@ public class Rate extends SubCommand {
146
148
  if (plot.getRatings().containsKey(player.getUUID())) {
147
149
  player.sendMessage(
148
150
  TranslatableCaption.of("ratings.rating_already_exists"),
149
- Template.of("plot", plot.getId().toString())
151
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
150
152
  );
151
153
  return;
152
154
  }
@@ -166,7 +168,7 @@ public class Rate extends SubCommand {
166
168
  plot.addRating(this.getPlayer().getUUID(), event.getRating());
167
169
  getPlayer().sendMessage(
168
170
  TranslatableCaption.of("ratings.rating_applied"),
169
- Template.of("plot", plot.getId().toString())
171
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
170
172
  );
171
173
  }
172
174
  return false;
@@ -239,7 +241,7 @@ public class Rate extends SubCommand {
239
241
  if (plot.getRatings().containsKey(uuid)) {
240
242
  player.sendMessage(
241
243
  TranslatableCaption.of("ratings.rating_already_exists"),
242
- Template.of("plot", plot.getId().toString())
244
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
243
245
  );
244
246
  return;
245
247
  }
@@ -249,7 +251,7 @@ public class Rate extends SubCommand {
249
251
  plot.addRating(uuid, event.getRating());
250
252
  player.sendMessage(
251
253
  TranslatableCaption.of("ratings.rating_applied"),
252
- Template.of("plot", plot.getId().toString())
254
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
253
255
  );
254
256
  }
255
257
  };
Core/src/main/java/com/plotsquared/core/command/RegenAllRoads.java CHANGED
@@ -26,7 +26,9 @@ import com.plotsquared.core.player.PlotPlayer;
26
26
  import com.plotsquared.core.plot.PlotArea;
27
27
  import com.plotsquared.core.plot.PlotManager;
28
28
  import com.plotsquared.core.plot.world.PlotAreaManager;
29
- import net.kyori.adventure.text.minimessage.Template;
29
+ import net.kyori.adventure.text.Component;
30
+ import net.kyori.adventure.text.minimessage.tag.Tag;
31
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
30
32
  import org.checkerframework.checker.nullness.qual.NonNull;
31
33
 
32
34
  @CommandDeclaration(command = "regenallroads",
@@ -58,18 +60,18 @@ public class RegenAllRoads extends SubCommand {
58
60
  } catch (NumberFormatException ignored) {
59
61
  player.sendMessage(
60
62
  TranslatableCaption.of("invalid.not_valid_number"),
61
- Template.of("value", "(0, 256)")
63
+ TagResolver.resolver("value", Tag.inserting(Component.text("(0, 256)")))
62
64
  );
63
65
  player.sendMessage(
64
66
  TranslatableCaption.of("commandconfig.command_syntax"),
65
- Template.of("value", "/plot regenallroads <world> [height]")
67
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot regenallroads <world> [height]")))
66
68
  );
67
69
  return false;
68
70
  }
69
71
  } else if (args.length != 1) {
70
72
  player.sendMessage(
71
73
  TranslatableCaption.of("commandconfig.command_syntax"),
72
- Template.of("value", "/plot regenallroads <world> [height]")
74
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot regenallroads <world> [height]")))
73
75
  );
74
76
  return false;
75
77
  }
@@ -77,7 +79,7 @@ public class RegenAllRoads extends SubCommand {
77
79
  if (area == null) {
78
80
  player.sendMessage(
79
81
  TranslatableCaption.of("errors.not_valid_plot_world"),
80
- Template.of("value", args[0])
82
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
81
83
  );
82
84
  return false;
83
85
  }
@@ -88,7 +90,7 @@ public class RegenAllRoads extends SubCommand {
88
90
  }
89
91
  player.sendMessage(
90
92
  TranslatableCaption.of("debugroadregen.schematic"),
91
- Template.of("command", "/plot createroadschematic")
93
+ TagResolver.resolver("command", Tag.inserting(Component.text("/plot createroadschematic")))
92
94
  );
93
95
  player.sendMessage(TranslatableCaption.of("debugroadregen.regenallroads_started"));
94
96
  boolean result = this.hybridUtils.scheduleRoadUpdate(area, height);
Core/src/main/java/com/plotsquared/core/command/Remove.java CHANGED
@@ -28,7 +28,9 @@ import com.plotsquared.core.plot.Plot;
28
28
  import com.plotsquared.core.util.EventDispatcher;
29
29
  import com.plotsquared.core.util.PlayerManager;
30
30
  import com.plotsquared.core.util.TabCompletions;
31
- import net.kyori.adventure.text.minimessage.Template;
31
+ import net.kyori.adventure.text.Component;
32
+ import net.kyori.adventure.text.minimessage.tag.Tag;
33
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
32
34
  import org.checkerframework.checker.nullness.qual.NonNull;
33
35
 
34
36
  import java.util.Collection;
@@ -77,7 +79,7 @@ public class Remove extends SubCommand {
77
79
  } else if (throwable != null) {
78
80
  player.sendMessage(
79
81
  TranslatableCaption.of("errors.invalid_player"),
80
- Template.of("value", args[0])
82
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
81
83
  );
82
84
  return;
83
85
  } else if (!uuids.isEmpty()) {
@@ -113,13 +115,13 @@ public class Remove extends SubCommand {
113
115
  }
114
116
  if (count == 0) {
115
117
  player.sendMessage(
116
- TranslatableCaption.of("member.player_not_removed"),
117
- Template.of("player", args[0])
118
+ TranslatableCaption.of("errors.invalid_player"),
119
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
118
120
  );
119
121
  } else {
120
122
  player.sendMessage(
121
123
  TranslatableCaption.of("member.removed_players"),
122
- Template.of("amount", count + "")
124
+ TagResolver.resolver("amount", Tag.inserting(Component.text(count)))
123
125
  );
124
126
  }
125
127
  });
Core/src/main/java/com/plotsquared/core/command/Save.java DELETED
@@ -1,130 +0,0 @@
1
- /*
2
- * PlotSquared, a land and world management plugin for Minecraft.
3
- * Copyright (C) IntellectualSites <https://intellectualsites.com>
4
- * Copyright (C) IntellectualSites team and contributors
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- */
19
- package com.plotsquared.core.command;
20
-
21
- import com.google.inject.Inject;
22
- import com.plotsquared.core.configuration.caption.TranslatableCaption;
23
- import com.plotsquared.core.location.Location;
24
- import com.plotsquared.core.permissions.Permission;
25
- import com.plotsquared.core.player.MetaDataAccess;
26
- import com.plotsquared.core.player.PlayerMetaDataKeys;
27
- import com.plotsquared.core.player.PlotPlayer;
28
- import com.plotsquared.core.plot.Plot;
29
- import com.plotsquared.core.plot.PlotId;
30
- import com.plotsquared.core.plot.world.PlotAreaManager;
31
- import com.plotsquared.core.util.SchematicHandler;
32
- import com.plotsquared.core.util.task.RunnableVal;
33
- import com.plotsquared.core.util.task.TaskManager;
34
- import net.kyori.adventure.text.minimessage.Template;
35
- import org.checkerframework.checker.nullness.qual.NonNull;
36
-
37
- import java.net.URL;
38
- import java.util.List;
39
- import java.util.UUID;
40
-
41
- /**
42
- * @deprecated In favor of "/plot download" (Arkitektonika) and scheduled
43
- * for removal within the next major release.
44
- */
45
- @Deprecated(forRemoval = true, since = "6.0.9")
46
- @CommandDeclaration(command = "save",
47
- category = CommandCategory.SCHEMATIC,
48
- requiredType = RequiredType.NONE,
49
- permission = "plots.save")
50
- public class Save extends SubCommand {
51
-
52
- private final PlotAreaManager plotAreaManager;
53
- private final SchematicHandler schematicHandler;
54
-
55
- @Inject
56
- public Save(
57
- final @NonNull PlotAreaManager plotAreaManager,
58
- final @NonNull SchematicHandler schematicHandler
59
- ) {
60
- this.plotAreaManager = plotAreaManager;
61
- this.schematicHandler = schematicHandler;
62
- }
63
-
64
- @Override
65
- public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
66
- final String world = player.getLocation().getWorldName();
67
- if (!this.plotAreaManager.hasPlotArea(world)) {
68
- player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
69
- return false;
70
- }
71
- final Plot plot = player.getCurrentPlot();
72
- if (plot == null) {
73
- player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
74
- return false;
75
- }
76
- if (!plot.hasOwner()) {
77
- player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
78
- return false;
79
- }
80
- if (plot.getVolume() > Integer.MAX_VALUE) {
81
- player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
82
- return false;
83
- }
84
- if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_SAVE)) {
85
- player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
86
- return false;
87
- }
88
- if (plot.getRunning() > 0) {
89
- player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
90
- return false;
91
- }
92
- plot.addRunning();
93
- this.schematicHandler.getCompoundTag(plot)
94
- .whenComplete((compoundTag, throwable) -> {
95
- TaskManager.runTaskAsync(() -> {
96
- String time = (System.currentTimeMillis() / 1000) + "";
97
- Location[] corners = plot.getCorners();
98
- corners[0] = corners[0].withY(plot.getArea().getMinBuildHeight());
99
- corners[1] = corners[1].withY(plot.getArea().getMaxBuildHeight());
100
- int size = (corners[1].getX() - corners[0].getX()) + 1;
101
- PlotId id = plot.getId();
102
- String world1 = plot.getArea().toString().replaceAll(";", "-")
103
- .replaceAll("[^A-Za-z0-9]", "");
104
- final String file = time + '_' + world1 + '_' + id.getX() + '_' + id.getY() + '_' + size;
105
- UUID uuid = player.getUUID();
106
- schematicHandler.upload(compoundTag, uuid, file, new RunnableVal<>() {
107
- @Override
108
- public void run(URL url) {
109
- plot.removeRunning();
110
- if (url == null) {
111
- player.sendMessage(TranslatableCaption.of("backups.backup_save_failed"));
112
- return;
113
- }
114
- player.sendMessage(TranslatableCaption.of("web.save_success"));
115
- player.sendMessage(
116
- TranslatableCaption.of("errors.deprecated_commands"),
117
- Template.of("replacement", "/plot download")
118
- );
119
- try (final MetaDataAccess<List<String>> schematicAccess =
120
- player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_SCHEMATICS)) {
121
- schematicAccess.get().ifPresent(schematics -> schematics.add(file + ".schem"));
122
- }
123
- }
124
- });
125
- });
126
- });
127
- return true;
128
- }
129
-
130
- }
Core/src/main/java/com/plotsquared/core/command/SchematicCmd.java CHANGED
@@ -35,7 +35,9 @@ import com.plotsquared.core.util.StringMan;
35
35
  import com.plotsquared.core.util.TabCompletions;
36
36
  import com.plotsquared.core.util.task.RunnableVal;
37
37
  import com.plotsquared.core.util.task.TaskManager;
38
- import net.kyori.adventure.text.minimessage.Template;
38
+ import net.kyori.adventure.text.Component;
39
+ import net.kyori.adventure.text.minimessage.tag.Tag;
40
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
39
41
  import org.checkerframework.checker.nullness.qual.NonNull;
40
42
 
41
43
  import java.net.URL;
@@ -72,7 +74,7 @@ public class SchematicCmd extends SubCommand {
72
74
  if (args.length < 1) {
73
75
  player.sendMessage(
74
76
  TranslatableCaption.of("commandconfig.command_syntax"),
75
- Template.of("value", "Possible values: save, paste, exportall, list")
77
+ TagResolver.resolver("value", Tag.inserting(Component.text("Possible values: save, paste, exportall, list")))
76
78
  );
77
79
  return true;
78
80
  }
@@ -82,14 +84,20 @@ public class SchematicCmd extends SubCommand {
82
84
  if (!player.hasPermission(Permission.PERMISSION_SCHEMATIC_PASTE)) {
83
85
  player.sendMessage(
84
86
  TranslatableCaption.of("permission.no_permission"),
85
- Template.of("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_PASTE))
87
+ TagResolver.resolver(
88
+ "node",
89
+ Tag.inserting(Permission.PERMISSION_SCHEMATIC_PASTE)
90
+ )
86
91
  );
87
92
  return false;
88
93
  }
89
94
  if (args.length < 2) {
90
95
  player.sendMessage(
91
96
  TranslatableCaption.of("commandconfig.command_syntax"),
92
- Template.of("value", "Possible values: save, paste, exportall, list")
97
+ TagResolver.resolver(
98
+ "value",
99
+ Tag.inserting(Component.text("Possible values: save, paste, exportall, list"))
100
+ )
93
101
  );
94
102
  break;
95
103
  }
@@ -129,7 +137,10 @@ public class SchematicCmd extends SubCommand {
129
137
  e.printStackTrace();
130
138
  player.sendMessage(
131
139
  TranslatableCaption.of("schematics.schematic_invalid"),
132
- Template.of("reason", "non-existent url: " + location)
140
+ TagResolver.resolver(
141
+ "reason",
142
+ Tag.inserting(Component.text("non-existent url: " + location))
143
+ )
133
144
  );
134
145
  SchematicCmd.this.running = false;
135
146
  return;
@@ -145,7 +156,10 @@ public class SchematicCmd extends SubCommand {
145
156
  SchematicCmd.this.running = false;
146
157
  player.sendMessage(
147
158
  TranslatableCaption.of("schematics.schematic_invalid"),
148
- Template.of("reason", "non-existent or not in gzip format")
159
+ TagResolver.resolver(
160
+ "reason",
161
+ Tag.inserting(Component.text("non-existent or not in gzip format"))
162
+ )
149
163
  );
150
164
  return;
151
165
  }
@@ -180,7 +194,10 @@ public class SchematicCmd extends SubCommand {
180
194
  player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_world_args"));
181
195
  player.sendMessage(
182
196
  TranslatableCaption.of("commandconfig.command_syntax"),
183
- Template.of("value", "Use /plot schematic exportall <area>")
197
+ TagResolver.resolver(
198
+ "value",
199
+ Tag.inserting(Component.text("Use /plot schematic exportall <area>"))
200
+ )
184
201
  );
185
202
  return false;
186
203
  }
@@ -188,7 +205,7 @@ public class SchematicCmd extends SubCommand {
188
205
  if (area == null) {
189
206
  player.sendMessage(
190
207
  TranslatableCaption.of("errors.not_valid_plot_world"),
191
- Template.of("value", args[1])
208
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
192
209
  );
193
210
  return false;
194
211
  }
@@ -197,7 +214,7 @@ public class SchematicCmd extends SubCommand {
197
214
  player.sendMessage(TranslatableCaption.of("schematic.schematic_exportall_world"));
198
215
  player.sendMessage(
199
216
  TranslatableCaption.of("commandconfig.command_syntax"),
200
- Template.of("value", "Use /plot sch exportall <area>")
217
+ TagResolver.resolver("value", Tag.inserting(Component.text("Use /plot sch exportall <area>")))
201
218
  );
202
219
  return false;
203
220
  }
@@ -211,7 +228,7 @@ public class SchematicCmd extends SubCommand {
211
228
  player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_started"));
212
229
  player.sendMessage(
213
230
  TranslatableCaption.of("schematics.plot_to_schem"),
214
- Template.of("amount", String.valueOf(plots.size()))
231
+ TagResolver.resolver("amount", Tag.inserting(Component.text(plots.size())))
215
232
  );
216
233
  }
217
234
  }
@@ -219,7 +236,10 @@ public class SchematicCmd extends SubCommand {
219
236
  if (!player.hasPermission(Permission.PERMISSION_SCHEMATIC_SAVE)) {
220
237
  player.sendMessage(
221
238
  TranslatableCaption.of("permission.no_permission"),
222
- Template.of("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_SAVE))
239
+ TagResolver.resolver(
240
+ "node",
241
+ Tag.inserting(Permission.PERMISSION_SCHEMATIC_SAVE)
242
+ )
223
243
  );
224
244
  return false;
225
245
  }
@@ -261,19 +281,22 @@ public class SchematicCmd extends SubCommand {
261
281
  if (!player.hasPermission(Permission.PERMISSION_SCHEMATIC_LIST)) {
262
282
  player.sendMessage(
263
283
  TranslatableCaption.of("permission.no_permission"),
264
- Template.of("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_LIST))
284
+ TagResolver.resolver(
285
+ "node",
286
+ Tag.inserting(Permission.PERMISSION_SCHEMATIC_LIST)
287
+ )
265
288
  );
266
289
  return false;
267
290
  }
268
291
  final String string = StringMan.join(this.schematicHandler.getSchematicNames(), "$2, $1");
269
292
  player.sendMessage(
270
293
  TranslatableCaption.of("schematics.schematic_list"),
271
- Template.of("list", string)
294
+ TagResolver.resolver("list", Tag.inserting(Component.text(string)))
272
295
  );
273
296
  }
274
297
  default -> player.sendMessage(
275
298
  TranslatableCaption.of("commandconfig.command_syntax"),
276
- Template.of("value", "Possible values: save, paste, exportall, list")
299
+ TagResolver.resolver("value", Tag.inserting(Component.text("Possible values: save, paste, exportall, list")))
277
300
  );
278
301
  }
279
302
  return true;
Core/src/main/java/com/plotsquared/core/command/Set.java CHANGED
@@ -39,7 +39,9 @@ import com.sk89q.worldedit.function.pattern.Pattern;
39
39
  import com.sk89q.worldedit.world.block.BlockCategory;
40
40
  import com.sk89q.worldedit.world.block.BlockType;
41
41
  import com.sk89q.worldedit.world.block.BlockTypes;
42
- import net.kyori.adventure.text.minimessage.Template;
42
+ import net.kyori.adventure.text.Component;
43
+ import net.kyori.adventure.text.minimessage.tag.Tag;
44
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
43
45
  import org.checkerframework.checker.nullness.qual.NonNull;
44
46
 
45
47
  import java.util.ArrayList;
@@ -122,7 +124,7 @@ public class Set extends SubCommand {
122
124
  }
123
125
  player.sendMessage(
124
126
  TranslatableCaption.of("invalid.component_illegal_block"),
125
- Template.of("value", forbiddenType)
127
+ TagResolver.resolver("value", Tag.inserting(Component.text(forbiddenType)))
126
128
  );
127
129
  return true;
128
130
  }
@@ -134,7 +136,10 @@ public class Set extends SubCommand {
134
136
  if (!player.hasPermission(Permission.PERMISSION_SET_COMPONENT.format(component))) {
135
137
  player.sendMessage(
136
138
  TranslatableCaption.of("permission.no_permission"),
137
- Template.of("node", Permission.PERMISSION_SET_COMPONENT.format(component))
139
+ TagResolver.resolver(
140
+ "node",
141
+ Tag.inserting(Component.text(Permission.PERMISSION_SET_COMPONENT.format(component)))
142
+ )
138
143
  );
139
144
  return false;
140
145
  }
@@ -157,7 +162,7 @@ public class Set extends SubCommand {
157
162
  plot.removeRunning();
158
163
  player.sendMessage(
159
164
  TranslatableCaption.of("working.component_complete"),
160
- Template.of("plot", plot.getId().toString())
165
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
161
166
  );
162
167
  });
163
168
  if (Settings.QUEUE.NOTIFY_PROGRESS) {
Core/src/main/java/com/plotsquared/core/command/SetCommand.java CHANGED
@@ -24,7 +24,9 @@ import com.plotsquared.core.permissions.Permission;
24
24
  import com.plotsquared.core.player.PlotPlayer;
25
25
  import com.plotsquared.core.plot.Plot;
26
26
  import com.plotsquared.core.util.StringMan;
27
- import net.kyori.adventure.text.minimessage.Template;
27
+ import net.kyori.adventure.text.Component;
28
+ import net.kyori.adventure.text.minimessage.tag.Tag;
29
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
28
30
 
29
31
  public abstract class SetCommand extends SubCommand {
30
32
 
@@ -40,7 +42,10 @@ public abstract class SetCommand extends SubCommand {
40
42
  if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
41
43
  player.sendMessage(
42
44
  TranslatableCaption.of("permission.no_permission"),
43
- Template.of("node", Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))
45
+ TagResolver.resolver(
46
+ "node",
47
+ Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_COMMAND.format(getFullId())))
48
+ )
44
49
  );
45
50
  player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
46
51
  return false;
@@ -50,7 +55,10 @@ public abstract class SetCommand extends SubCommand {
50
55
  if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
51
56
  player.sendMessage(
52
57
  TranslatableCaption.of("permission.no_permission"),
53
- Template.of("node", Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))
58
+ TagResolver.resolver(
59
+ "node",
60
+ Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_COMMAND.format(getFullId())))
61
+ )
54
62
  );
55
63
  player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
56
64
  return false;
Core/src/main/java/com/plotsquared/core/command/SetHome.java CHANGED
@@ -23,7 +23,9 @@ import com.plotsquared.core.location.BlockLoc;
23
23
  import com.plotsquared.core.location.Location;
24
24
  import com.plotsquared.core.player.PlotPlayer;
25
25
  import com.plotsquared.core.plot.Plot;
26
- import net.kyori.adventure.text.minimessage.Template;
26
+ import net.kyori.adventure.text.Component;
27
+ import net.kyori.adventure.text.minimessage.tag.Tag;
28
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
27
29
 
28
30
  @CommandDeclaration(command = "sethome",
29
31
  permission = "plots.set.home",
@@ -64,7 +66,7 @@ public class SetHome extends SetCommand {
64
66
  default -> {
65
67
  player.sendMessage(
66
68
  TranslatableCaption.of("commandconfig.command_syntax"),
67
- Template.of("value", "Use /plot set home [none]")
69
+ TagResolver.resolver("value", Tag.inserting(Component.text("Use /plot set home [none]")))
68
70
  );
69
71
  return false;
70
72
  }
Core/src/main/java/com/plotsquared/core/command/Setup.java CHANGED
@@ -29,7 +29,9 @@ import com.plotsquared.core.player.PlotPlayer;
29
29
  import com.plotsquared.core.setup.SetupProcess;
30
30
  import com.plotsquared.core.setup.SetupStep;
31
31
  import com.plotsquared.core.util.SetupUtils;
32
- import net.kyori.adventure.text.minimessage.Template;
32
+ import net.kyori.adventure.text.Component;
33
+ import net.kyori.adventure.text.minimessage.tag.Tag;
34
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
33
35
  import org.checkerframework.checker.nullness.qual.NonNull;
34
36
 
35
37
  import java.util.ArrayList;
@@ -78,7 +80,10 @@ public class Setup extends SubCommand {
78
80
  player.sendMessage(TranslatableCaption.of("setup.setup_not_started"));
79
81
  player.sendMessage(
80
82
  TranslatableCaption.of("commandconfig.command_syntax"),
81
- Template.of("value", "Use /plot setup to start a setup process.")
83
+ TagResolver.resolver(
84
+ "value",
85
+ Tag.inserting(Component.text("Use /plot setup to start a setup process."))
86
+ )
82
87
  );
83
88
  return true;
84
89
  }
Core/src/main/java/com/plotsquared/core/command/Swap.java CHANGED
@@ -25,7 +25,9 @@ import com.plotsquared.core.player.PlotPlayer;
25
25
  import com.plotsquared.core.plot.Plot;
26
26
  import com.plotsquared.core.util.task.RunnableVal2;
27
27
  import com.plotsquared.core.util.task.RunnableVal3;
28
- import net.kyori.adventure.text.minimessage.Template;
28
+ import net.kyori.adventure.text.Component;
29
+ import net.kyori.adventure.text.minimessage.tag.Tag;
30
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
29
31
 
30
32
  import java.util.concurrent.CompletableFuture;
31
33
 
@@ -82,8 +84,10 @@ public class Swap extends SubCommand {
82
84
  if (result) {
83
85
  player.sendMessage(
84
86
  TranslatableCaption.of("swap.swap_success"),
85
- Template.of("origin", p1),
86
- Template.of("target", p2)
87
+ TagResolver.builder()
88
+ .tag("origin", Tag.inserting(Component.text(p1)))
89
+ .tag("target", Tag.inserting(Component.text(p2)))
90
+ .build()
87
91
  );
88
92
  return true;
89
93
  } else {
Core/src/main/java/com/plotsquared/core/command/Target.java CHANGED
@@ -24,7 +24,9 @@ import com.plotsquared.core.player.PlotPlayer;
24
24
  import com.plotsquared.core.plot.Plot;
25
25
  import com.plotsquared.core.util.StringMan;
26
26
  import com.plotsquared.core.util.query.PlotQuery;
27
- import net.kyori.adventure.text.minimessage.Template;
27
+ import net.kyori.adventure.text.Component;
28
+ import net.kyori.adventure.text.minimessage.tag.Tag;
29
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
28
30
 
29
31
  import java.util.Collection;
30
32
  import java.util.Locale;
@@ -52,7 +54,7 @@ public class Target extends SubCommand {
52
54
  if (args.length == 0) {
53
55
  player.sendMessage(
54
56
  TranslatableCaption.of("commandconfig.command_syntax"),
55
- Template.of("value", "/plot target <<X;Z> | nearest>")
57
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot target <<X;Z> | nearest>")))
56
58
  );
57
59
  return false;
58
60
  }
@@ -76,7 +78,7 @@ public class Target extends SubCommand {
76
78
  target.getCenter(player::setCompassTarget);
77
79
  player.sendMessage(
78
80
  TranslatableCaption.of("compass.compass_target"),
79
- Template.of("target", target.toString())
81
+ TagResolver.resolver("target", Tag.inserting(Component.text(target.toString())))
80
82
  );
81
83
  return true;
82
84
  }
Core/src/main/java/com/plotsquared/core/command/Template.java CHANGED
@@ -43,6 +43,9 @@ import com.plotsquared.core.util.SetupUtils;
43
43
  import com.plotsquared.core.util.TabCompletions;
44
44
  import com.plotsquared.core.util.WorldUtil;
45
45
  import com.plotsquared.core.util.task.TaskManager;
46
+ import net.kyori.adventure.text.Component;
47
+ import net.kyori.adventure.text.minimessage.tag.Tag;
48
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
46
49
  import org.checkerframework.checker.nullness.qual.NonNull;
47
50
 
48
51
  import java.io.File;
@@ -168,13 +171,16 @@ public class Template extends SubCommand {
168
171
  if (args[0].equalsIgnoreCase("export")) {
169
172
  player.sendMessage(
170
173
  TranslatableCaption.of("commandconfig.command_syntax"),
171
- net.kyori.adventure.text.minimessage.Template.of("value", "/plot template export <world>")
174
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot template export <world>")))
172
175
  );
173
176
  return true;
174
177
  } else if (args[0].equalsIgnoreCase("import")) {
175
178
  player.sendMessage(
176
179
  TranslatableCaption.of("commandconfig.command_syntax"),
177
- net.kyori.adventure.text.minimessage.Template.of("value", "/plot template import <world> <template>")
180
+ TagResolver.resolver(
181
+ "value",
182
+ Tag.inserting(Component.text("/plot template import <world> <template>"))
183
+ )
178
184
  );
179
185
  return true;
180
186
  }
@@ -188,14 +194,17 @@ public class Template extends SubCommand {
188
194
  if (args.length != 3) {
189
195
  player.sendMessage(
190
196
  TranslatableCaption.of("commandconfig.command_syntax"),
191
- net.kyori.adventure.text.minimessage.Template.of("value", "/plot template import <world> <template>")
197
+ TagResolver.resolver(
198
+ "value",
199
+ Tag.inserting(Component.text("/plot template import <world> <template>"))
200
+ )
192
201
  );
193
202
  return false;
194
203
  }
195
204
  if (this.plotAreaManager.hasPlotArea(world)) {
196
205
  player.sendMessage(
197
206
  TranslatableCaption.of("setup.setup_world_taken"),
198
- net.kyori.adventure.text.minimessage.Template.of("value", world)
207
+ TagResolver.resolver("value", Tag.inserting(Component.text(world)))
199
208
  );
200
209
  return false;
201
210
  }
@@ -203,7 +212,7 @@ public class Template extends SubCommand {
203
212
  if (!result) {
204
213
  player.sendMessage(
205
214
  TranslatableCaption.of("template.invalid_template"),
206
- net.kyori.adventure.text.minimessage.Template.of("value", args[2])
215
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[2])))
207
216
  );
208
217
  return false;
209
218
  }
@@ -241,7 +250,7 @@ public class Template extends SubCommand {
241
250
  if (args.length != 2) {
242
251
  player.sendMessage(
243
252
  TranslatableCaption.of("commandconfig.command_syntax"),
244
- net.kyori.adventure.text.minimessage.Template.of("value", "/plot template export <world>")
253
+ TagResolver.resolver("value", Tag.inserting(Component.text("/plot template export <world>")))
245
254
  );
246
255
  return false;
247
256
  }
@@ -249,7 +258,7 @@ public class Template extends SubCommand {
249
258
  if (area == null) {
250
259
  player.sendMessage(
251
260
  TranslatableCaption.of("errors.not_valid_plot_world"),
252
- net.kyori.adventure.text.minimessage.Template.of("value", args[1])
261
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
253
262
  );
254
263
  return false;
255
264
  }
@@ -261,7 +270,7 @@ public class Template extends SubCommand {
261
270
  e.printStackTrace();
262
271
  player.sendMessage(
263
272
  TranslatableCaption.of("template.template_failed"),
264
- net.kyori.adventure.text.minimessage.Template.of("value", e.getMessage())
273
+ TagResolver.resolver("value", Tag.inserting(Component.text(e.getMessage())))
265
274
  );
266
275
  return;
267
276
  }
Core/src/main/java/com/plotsquared/core/command/Toggle.java CHANGED
@@ -22,7 +22,9 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
22
22
  import com.plotsquared.core.player.PlotPlayer;
23
23
  import com.plotsquared.core.util.task.RunnableVal2;
24
24
  import com.plotsquared.core.util.task.RunnableVal3;
25
- import net.kyori.adventure.text.minimessage.Template;
25
+ import net.kyori.adventure.text.Component;
26
+ import net.kyori.adventure.text.minimessage.tag.Tag;
27
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
26
28
 
27
29
  @CommandDeclaration(command = "toggle",
28
30
  aliases = {"attribute"},
@@ -47,12 +49,12 @@ public class Toggle extends Command {
47
49
  if (toggle(player, "chatspy")) {
48
50
  player.sendMessage(
49
51
  TranslatableCaption.of("toggle.toggle_disabled"),
50
- Template.of("setting", command.toString())
52
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
51
53
  );
52
54
  } else {
53
55
  player.sendMessage(
54
56
  TranslatableCaption.of("toggle.toggle_enabled"),
55
- Template.of("setting", command.toString())
57
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
56
58
  );
57
59
  }
58
60
  }
@@ -68,12 +70,12 @@ public class Toggle extends Command {
68
70
  if (toggle(player, "worldedit")) {
69
71
  player.sendMessage(
70
72
  TranslatableCaption.of("toggle.toggle_disabled"),
71
- Template.of("setting", command.toString())
73
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
72
74
  );
73
75
  } else {
74
76
  player.sendMessage(
75
77
  TranslatableCaption.of("toggle.toggle_enabled"),
76
- Template.of("setting", command.toString())
78
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
77
79
  );
78
80
  }
79
81
  }
@@ -88,12 +90,12 @@ public class Toggle extends Command {
88
90
  if (toggle(player, "chat")) {
89
91
  player.sendMessage(
90
92
  TranslatableCaption.of("toggle.toggle_disabled"),
91
- Template.of("setting", command.toString())
93
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
92
94
  );
93
95
  } else {
94
96
  player.sendMessage(
95
97
  TranslatableCaption.of("toggle.toggle_enabled"),
96
- Template.of("setting", command.toString())
98
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
97
99
  );
98
100
  }
99
101
  }
@@ -108,12 +110,12 @@ public class Toggle extends Command {
108
110
  if (toggle(player, "ignoreExpireTask")) {
109
111
  player.sendMessage(
110
112
  TranslatableCaption.of("toggle.toggle_enabled"),
111
- Template.of("setting", command.toString())
113
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
112
114
  );
113
115
  } else {
114
116
  player.sendMessage(
115
117
  TranslatableCaption.of("toggle.toggle_disabled"),
116
- Template.of("setting", command.toString())
118
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
117
119
  );
118
120
  }
119
121
  }
@@ -128,12 +130,12 @@ public class Toggle extends Command {
128
130
  if (toggle(player, "disabletitles")) {
129
131
  player.sendMessage(
130
132
  TranslatableCaption.of("toggle.toggle_enabled"),
131
- Template.of("setting", command.toString())
133
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
132
134
  );
133
135
  } else {
134
136
  player.sendMessage(
135
137
  TranslatableCaption.of("toggle.toggle_disabled"),
136
- Template.of("setting", command.toString())
138
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
137
139
  );
138
140
  }
139
141
  }
@@ -148,12 +150,12 @@ public class Toggle extends Command {
148
150
  if (toggle(player, "disabletime")) {
149
151
  player.sendMessage(
150
152
  TranslatableCaption.of("toggle.toggle_enabled"),
151
- Template.of("setting", command.toString())
153
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
152
154
  );
153
155
  } else {
154
156
  player.sendMessage(
155
157
  TranslatableCaption.of("toggle.toggle_disabled"),
156
- Template.of("setting", command.toString())
158
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
157
159
  );
158
160
  }
159
161
  }
@@ -168,12 +170,12 @@ public class Toggle extends Command {
168
170
  if (toggle(player, "debug")) {
169
171
  player.sendMessage(
170
172
  TranslatableCaption.of("toggle.toggle_disabled"),
171
- Template.of("setting", command.toString())
173
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
172
174
  );
173
175
  } else {
174
176
  player.sendMessage(
175
177
  TranslatableCaption.of("toggle.toggle_enabled"),
176
- Template.of("setting", command.toString())
178
+ TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
177
179
  );
178
180
  }
179
181
  player.refreshDebug();
Core/src/main/java/com/plotsquared/core/command/Trust.java CHANGED
@@ -20,7 +20,6 @@ package com.plotsquared.core.command;
20
20
 
21
21
  import com.google.inject.Inject;
22
22
  import com.plotsquared.core.configuration.Settings;
23
- import com.plotsquared.core.configuration.caption.Templates;
24
23
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
25
24
  import com.plotsquared.core.database.DBFunc;
26
25
  import com.plotsquared.core.permissions.Permission;
@@ -31,7 +30,9 @@ import com.plotsquared.core.util.PlayerManager;
31
30
  import com.plotsquared.core.util.TabCompletions;
32
31
  import com.plotsquared.core.util.task.RunnableVal2;
33
32
  import com.plotsquared.core.util.task.RunnableVal3;
34
- import net.kyori.adventure.text.minimessage.Template;
33
+ import net.kyori.adventure.text.Component;
34
+ import net.kyori.adventure.text.minimessage.tag.Tag;
35
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
35
36
  import org.checkerframework.checker.nullness.qual.NonNull;
36
37
 
37
38
  import java.util.Collection;
@@ -73,7 +74,7 @@ public class Trust extends Command {
73
74
  );
74
75
 
75
76
  checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
76
- Templates.of("value", getUsage())
77
+ TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
77
78
  );
78
79
 
79
80
  final CompletableFuture<Boolean> future = new CompletableFuture<>();
@@ -84,14 +85,14 @@ public class Trust extends Command {
84
85
  } else {
85
86
  player.sendMessage(
86
87
  TranslatableCaption.of("errors.invalid_player"),
87
- Template.of("value", args[0])
88
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
88
89
  );
89
90
  }
90
91
  future.completeExceptionally(throwable);
91
92
  return;
92
93
  } else {
93
94
  checkTrue(!uuids.isEmpty(), TranslatableCaption.of("errors.invalid_player"),
94
- Templates.of("value", args[0])
95
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
95
96
  );
96
97
 
97
98
  Iterator<UUID> iterator = uuids.iterator();
@@ -102,7 +103,10 @@ public class Trust extends Command {
102
103
  player.hasPermission(Permission.PERMISSION_TRUST_EVERYONE) || player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
103
104
  player.sendMessage(
104
105
  TranslatableCaption.of("errors.invalid_player"),
105
- Template.of("value", PlayerManager.resolveName(uuid).getComponent(player))
106
+ TagResolver.resolver(
107
+ "value",
108
+ Tag.inserting(PlayerManager.resolveName(uuid).toComponent(player))
109
+ )
106
110
  );
107
111
  iterator.remove();
108
112
  continue;
@@ -110,7 +114,10 @@ public class Trust extends Command {
110
114
  if (currentPlot.isOwner(uuid)) {
111
115
  player.sendMessage(
112
116
  TranslatableCaption.of("member.already_added"),
113
- Template.of("value", PlayerManager.resolveName(uuid).getComponent(player))
117
+ TagResolver.resolver(
118
+ "value",
119
+ Tag.inserting(PlayerManager.resolveName(uuid).toComponent(player))
120
+ )
114
121
  );
115
122
  iterator.remove();
116
123
  continue;
@@ -118,7 +125,10 @@ public class Trust extends Command {
118
125
  if (currentPlot.getTrusted().contains(uuid)) {
119
126
  player.sendMessage(
120
127
  TranslatableCaption.of("member.already_added"),
121
- Template.of("value", PlayerManager.resolveName(uuid).getComponent(player))
128
+ TagResolver.resolver(
129
+ "value",
130
+ Tag.inserting(PlayerManager.resolveName(uuid).toComponent(player))
131
+ )
122
132
  );
123
133
  iterator.remove();
124
134
  continue;
@@ -131,7 +141,7 @@ public class Trust extends Command {
131
141
  if (localTrustSize >= maxTrustSize) {
132
142
  player.sendMessage(
133
143
  TranslatableCaption.of("members.plot_max_members_trusted"),
134
- Template.of("amount", String.valueOf(localTrustSize))
144
+ TagResolver.resolver("amount", Tag.inserting(Component.text(localTrustSize)))
135
145
  );
136
146
  return;
137
147
  }
Core/src/main/java/com/plotsquared/core/command/Unlink.java CHANGED
@@ -29,7 +29,9 @@ import com.plotsquared.core.plot.Plot;
29
29
  import com.plotsquared.core.util.EventDispatcher;
30
30
  import com.plotsquared.core.util.StringMan;
31
31
  import com.plotsquared.core.util.task.TaskManager;
32
- import net.kyori.adventure.text.minimessage.Template;
32
+ import net.kyori.adventure.text.Component;
33
+ import net.kyori.adventure.text.minimessage.tag.Tag;
34
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
33
35
  import org.checkerframework.checker.nullness.qual.NonNull;
34
36
 
35
37
  @CommandDeclaration(command = "unlink",
@@ -85,7 +87,7 @@ public class Unlink extends SubCommand {
85
87
  if (event.getEventResult() == Result.DENY) {
86
88
  player.sendMessage(
87
89
  TranslatableCaption.of("events.event_denied"),
88
- Template.of("value", "Unlink")
90
+ TagResolver.resolver("value", Tag.inserting(Component.text("Unlink")))
89
91
  );
90
92
  return true;
91
93
  }
Core/src/main/java/com/plotsquared/core/command/Visit.java CHANGED
@@ -21,7 +21,6 @@ package com.plotsquared.core.command;
21
21
  import com.google.inject.Inject;
22
22
  import com.plotsquared.core.PlotSquared;
23
23
  import com.plotsquared.core.configuration.Settings;
24
- import com.plotsquared.core.configuration.caption.Templates;
25
24
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
26
25
  import com.plotsquared.core.events.TeleportCause;
27
26
  import com.plotsquared.core.permissions.Permission;
@@ -37,7 +36,9 @@ import com.plotsquared.core.util.query.PlotQuery;
37
36
  import com.plotsquared.core.util.query.SortingStrategy;
38
37
  import com.plotsquared.core.util.task.RunnableVal2;
39
38
  import com.plotsquared.core.util.task.RunnableVal3;
40
- import net.kyori.adventure.text.minimessage.Template;
39
+ import net.kyori.adventure.text.Component;
40
+ import net.kyori.adventure.text.minimessage.tag.Tag;
41
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
41
42
  import org.checkerframework.checker.nullness.qual.NonNull;
42
43
 
43
44
  import java.util.ArrayList;
@@ -99,8 +100,10 @@ public class Visit extends Command {
99
100
  } else if (plots.size() < page || page < 1) {
100
101
  player.sendMessage(
101
102
  TranslatableCaption.of("invalid.number_not_in_range"),
102
- Template.of("min", "1"),
103
- Template.of("max", String.valueOf(plots.size()))
103
+ TagResolver.builder()
104
+ .tag("min", Tag.inserting(Component.text(1)))
105
+ .tag("max", Tag.inserting(Component.text(plots.size())))
106
+ .build()
104
107
  );
105
108
  return;
106
109
  }
@@ -110,7 +113,7 @@ public class Visit extends Command {
110
113
  if (!player.hasPermission(Permission.PERMISSION_VISIT_UNOWNED)) {
111
114
  player.sendMessage(
112
115
  TranslatableCaption.of("permission.no_permission"),
113
- Templates.of("node", "plots.visit.unowned")
116
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.unowned")))
114
117
  );
115
118
  return;
116
119
  }
@@ -118,7 +121,7 @@ public class Visit extends Command {
118
121
  if (!player.hasPermission(Permission.PERMISSION_VISIT_OWNED) && !player.hasPermission(Permission.PERMISSION_HOME)) {
119
122
  player.sendMessage(
120
123
  TranslatableCaption.of("permission.no_permission"),
121
- Templates.of("node", "plots.visit.owned")
124
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.owned")))
122
125
  );
123
126
  return;
124
127
  }
@@ -126,7 +129,7 @@ public class Visit extends Command {
126
129
  if (!player.hasPermission(Permission.PERMISSION_SHARED)) {
127
130
  player.sendMessage(
128
131
  TranslatableCaption.of("permission.no_permission"),
129
- Templates.of("node", "plots.visit.shared")
132
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.shared")))
130
133
  );
131
134
  return;
132
135
  }
@@ -137,7 +140,7 @@ public class Visit extends Command {
137
140
  && !player.hasPermission(Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
138
141
  player.sendMessage(
139
142
  TranslatableCaption.of("permission.no_permission"),
140
- Templates.of("node", "plots.visit.other")
143
+ TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.other")))
141
144
  );
142
145
  return;
143
146
  }
@@ -145,7 +148,10 @@ public class Visit extends Command {
145
148
  if (!player.hasPermission(Permission.PERMISSION_VISIT_DENIED)) {
146
149
  player.sendMessage(
147
150
  TranslatableCaption.of("permission.no_permission"),
148
- Template.of("node", String.valueOf(Permission.PERMISSION_VISIT_DENIED))
151
+ TagResolver.resolver(
152
+ "node",
153
+ Tag.inserting(Permission.PERMISSION_VISIT_DENIED)
154
+ )
149
155
  );
150
156
  return;
151
157
  }
@@ -187,11 +193,11 @@ public class Visit extends Command {
187
193
  if (!MathMan.isInteger(args[2])) {
188
194
  player.sendMessage(
189
195
  TranslatableCaption.of("invalid.not_valid_number"),
190
- Templates.of("value", "(1, ∞)")
196
+ TagResolver.resolver("value", Tag.inserting(Component.text("(1, ∞)")))
191
197
  );
192
198
  player.sendMessage(
193
199
  TranslatableCaption.of("commandconfig.command_syntax"),
194
- Templates.of("value", getUsage())
200
+ TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
195
201
  );
196
202
  return CompletableFuture.completedFuture(false);
197
203
  }
@@ -204,11 +210,11 @@ public class Visit extends Command {
204
210
  if (sortByArea == null) {
205
211
  player.sendMessage(
206
212
  TranslatableCaption.of("invalid.not_valid_number"),
207
- Templates.of("value", "(1, ∞)")
213
+ TagResolver.resolver("value", Tag.inserting(Component.text("(1, ∞)")))
208
214
  );
209
215
  player.sendMessage(
210
216
  TranslatableCaption.of("commandconfig.command_syntax"),
211
- Templates.of("value", getUsage())
217
+ TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
212
218
  );
213
219
  return CompletableFuture.completedFuture(false);
214
220
  }
@@ -221,7 +227,7 @@ public class Visit extends Command {
221
227
  } else if (throwable != null || uuids.size() != 1) {
222
228
  player.sendMessage(
223
229
  TranslatableCaption.of("commandconfig.command_syntax"),
224
- Templates.of("value", getUsage())
230
+ TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
225
231
  );
226
232
  } else {
227
233
  final UUID uuid = uuids.toArray(new UUID[0])[0];
@@ -248,7 +254,7 @@ public class Visit extends Command {
248
254
  } catch (NumberFormatException ignored) {
249
255
  player.sendMessage(
250
256
  TranslatableCaption.of("invalid.not_a_number"),
251
- Template.of("value", args[1])
257
+ TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
252
258
  );
253
259
  return CompletableFuture.completedFuture(false);
254
260
  }
@@ -283,7 +289,7 @@ public class Visit extends Command {
283
289
  } else {
284
290
  player.sendMessage(
285
291
  TranslatableCaption.of("errors.invalid_player"),
286
- Template.of("value", finalArgs[0])
292
+ TagResolver.resolver("value", Tag.inserting(Component.text(finalArgs[0])))
287
293
  );
288
294
  }
289
295
  } else {
@@ -311,7 +317,7 @@ public class Visit extends Command {
311
317
  // /p v is invalid
312
318
  player.sendMessage(
313
319
  TranslatableCaption.of("commandconfig.command_syntax"),
314
- Templates.of("value", getUsage())
320
+ TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
315
321
  );
316
322
  return CompletableFuture.completedFuture(false);
317
323
  default:
Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java CHANGED
@@ -37,8 +37,10 @@ import com.plotsquared.core.util.InventoryUtil;
37
37
  import com.plotsquared.core.util.PatternUtil;
38
38
  import com.sk89q.worldedit.function.pattern.Pattern;
39
39
  import com.sk89q.worldedit.world.item.ItemTypes;
40
+ import net.kyori.adventure.text.Component;
40
41
  import net.kyori.adventure.text.minimessage.MiniMessage;
41
- import net.kyori.adventure.text.minimessage.Template;
42
+ import net.kyori.adventure.text.minimessage.tag.Tag;
43
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
42
44
  import org.apache.logging.log4j.LogManager;
43
45
  import org.apache.logging.log4j.Logger;
44
46
  import org.checkerframework.checker.nullness.qual.NonNull;
@@ -176,7 +178,8 @@ public class ComponentPresetManager {
176
178
  }
177
179
  final int size = (int) Math.ceil((double) allowedPresets.size() / 9.0D);
178
180
  final PlotInventory plotInventory = new PlotInventory(this.inventoryUtil, player, size,
179
- TranslatableCaption.of("preset.title").getComponent(player)) {
181
+ TranslatableCaption.of("preset.title").getComponent(player)
182
+ ) {
180
183
  @Override
181
184
  public boolean onClick(final int index) {
182
185
  if (!getPlayer().getCurrentPlot().equals(plot)) {
@@ -207,7 +210,8 @@ public class ComponentPresetManager {
207
210
  if (!econHandler.isEnabled(plot.getArea())) {
208
211
  getPlayer().sendMessage(
209
212
  TranslatableCaption.of("preset.economy_disabled"),
210
- Template.of("preset", componentPreset.getDisplayName()));
213
+ TagResolver.resolver("preset", Tag.inserting(Component.text(componentPreset.getDisplayName())))
214
+ );
211
215
  return false;
212
216
  }
213
217
  if (econHandler.getMoney(getPlayer()) < componentPreset.getCost()) {
@@ -217,7 +221,10 @@ public class ComponentPresetManager {
217
221
  econHandler.withdrawMoney(getPlayer(), componentPreset.getCost());
218
222
  getPlayer().sendMessage(
219
223
  TranslatableCaption.of("economy.removed_balance"),
220
- Template.of("money", econHandler.format(componentPreset.getCost()))
224
+ TagResolver.resolver(
225
+ "money",
226
+ Tag.inserting(Component.text(econHandler.format(componentPreset.getCost())))
227
+ )
221
228
  );
222
229
  }
223
230
  }
@@ -247,19 +254,21 @@ public class ComponentPresetManager {
247
254
  final List<String> lore = new ArrayList<>();
248
255
  if (preset.getCost() > 0) {
249
256
  if (!this.econHandler.isEnabled(plot.getArea())) {
250
- lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
257
+ lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.deserialize(
251
258
  TranslatableCaption.of("preset.preset_lore_economy_disabled").getComponent(player))));
252
259
  } else {
253
- lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
260
+ lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.deserialize(
254
261
  TranslatableCaption.of("preset.preset_lore_cost").getComponent(player),
255
- Template.of("cost", String.format("%.2f", preset.getCost()))
262
+ TagResolver.resolver("cost", Tag.inserting(Component.text(String.format("%.2f", preset.getCost()))))
256
263
  )));
257
264
  }
258
265
  }
259
- lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
266
+ lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.deserialize(
260
267
  TranslatableCaption.of("preset.preset_lore_component").getComponent(player),
261
- Template.of("component", preset.getComponent().name().toLowerCase()),
262
- Template.of("prefix", TranslatableCaption.of("core.prefix").getComponent(player))
268
+ TagResolver.builder()
269
+ .tag("component", Tag.inserting(Component.text(preset.getComponent().name().toLowerCase())))
270
+ .tag("prefix", Tag.inserting(TranslatableCaption.of("core.prefix").toComponent(player)))
271
+ .build()
263
272
  )));
264
273
  lore.removeIf(String::isEmpty);
265
274
  lore.addAll(preset.getDescription());
Core/src/main/java/com/plotsquared/core/configuration/caption/Caption.java CHANGED
@@ -18,6 +18,8 @@
18
18
  */
19
19
  package com.plotsquared.core.configuration.caption;
20
20
 
21
+ import net.kyori.adventure.text.Component;
22
+ import net.kyori.adventure.text.ComponentLike;
21
23
  import org.checkerframework.checker.nullness.qual.NonNull;
22
24
 
23
25
  /**
@@ -33,4 +35,13 @@ public interface Caption {
33
35
  */
34
36
  @NonNull String getComponent(@NonNull LocaleHolder localeHolder);
35
37
 
38
+ /**
39
+ * Get the Adventure {@link ComponentLike} for this caption
40
+ *
41
+ * @param localeHolder Locale holder
42
+ * @return {@link ComponentLike}
43
+ * @since TODO
44
+ */
45
+ @NonNull Component toComponent(@NonNull LocaleHolder localeHolder);
46
+
36
47
  }
Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionHolder.java CHANGED
@@ -18,27 +18,53 @@
18
18
  */
19
19
  package com.plotsquared.core.configuration.caption;
20
20
 
21
- import net.kyori.adventure.text.minimessage.Template;
21
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
22
22
 
23
+ /**
24
+ * A holder for a caption.
25
+ * Useful when constructing messages in multiple steps with {@link TagResolver}s.
26
+ */
23
27
  public class CaptionHolder {
24
28
 
25
29
  private Caption caption = StaticCaption.of("");
26
- private Template[] templates = new Template[0];
30
+ private TagResolver[] tagResolvers = new TagResolver[0];
27
31
 
32
+ /**
33
+ * Set the {@link Caption} to send.
34
+ *
35
+ * @param caption The new caption.
36
+ */
28
37
  public void set(Caption caption) {
29
38
  this.caption = caption;
30
39
  }
31
40
 
41
+ /**
42
+ * Get the {@link Caption} to send.
43
+ *
44
+ * @return The caption to send.
45
+ */
32
46
  public Caption get() {
33
47
  return this.caption;
34
48
  }
35
49
 
36
- public Template[] getTemplates() {
37
- return this.templates;
50
+ /**
51
+ * Get the {@link TagResolver}s to use when resolving tags in the {@link Caption}.
52
+ *
53
+ * @return The tag resolvers to use.
54
+ * @since TODO
55
+ */
56
+ public TagResolver[] getTagResolvers() {
57
+ return this.tagResolvers;
38
58
  }
39
59
 
40
- public void setTemplates(Template... templates) {
41
- this.templates = templates;
60
+ /**
61
+ * Set the {@link TagResolver}s to use when resolving tags in the {@link Caption}.
62
+ *
63
+ * @param tagResolvers The tag resolvers to use.
64
+ * @since TODO
65
+ */
66
+ public void setTagResolvers(TagResolver... tagResolvers) {
67
+ this.tagResolvers = tagResolvers;
42
68
  }
43
69
 
44
70
  }
Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java CHANGED
@@ -100,9 +100,9 @@ public class CaptionUtility {
100
100
  */
101
101
  public static String stripClickEvents(final @NonNull String miniMessageString) {
102
102
  // parse, transform and serialize again
103
- Component component = MiniMessage.get().parse(miniMessageString);
103
+ Component component = MiniMessage.miniMessage().deserialize(miniMessageString);
104
104
  component = CLICK_STRIP_TRANSFORM.transform(component);
105
- return MiniMessage.get().serialize(component);
105
+ return MiniMessage.miniMessage().serialize(component);
106
106
  }
107
107
 
108
108
  /**
Core/src/main/java/com/plotsquared/core/configuration/caption/StaticCaption.java CHANGED
@@ -19,6 +19,8 @@
19
19
  package com.plotsquared.core.configuration.caption;
20
20
 
21
21
  import com.google.common.base.Preconditions;
22
+ import net.kyori.adventure.text.Component;
23
+ import net.kyori.adventure.text.minimessage.MiniMessage;
22
24
  import org.checkerframework.checker.nullness.qual.NonNull;
23
25
 
24
26
  public final class StaticCaption implements Caption {
@@ -44,4 +46,9 @@ public final class StaticCaption implements Caption {
44
46
  return this.value; // can't be translated
45
47
  }
46
48
 
49
+ @Override
50
+ public @NonNull Component toComponent(@NonNull final LocaleHolder localeHolder) {
51
+ return MiniMessage.miniMessage().deserialize(this.value);
52
+ }
53
+
47
54
  }
Core/src/main/java/com/plotsquared/core/configuration/caption/Templates.java DELETED
@@ -1,103 +0,0 @@
1
- /*
2
- * PlotSquared, a land and world management plugin for Minecraft.
3
- * Copyright (C) IntellectualSites <https://intellectualsites.com>
4
- * Copyright (C) IntellectualSites team and contributors
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- */
19
- package com.plotsquared.core.configuration.caption;
20
-
21
- import com.plotsquared.core.plot.PlotArea;
22
- import com.plotsquared.core.util.PlayerManager;
23
- import net.kyori.adventure.text.minimessage.MiniMessage;
24
- import net.kyori.adventure.text.minimessage.Template;
25
- import org.checkerframework.checker.nullness.qual.NonNull;
26
-
27
- import java.util.UUID;
28
-
29
- /**
30
- * Utility class that generates {@link net.kyori.adventure.text.minimessage.Template templates}
31
- */
32
- public final class Templates {
33
-
34
- private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
35
-
36
- private Templates() {
37
- throw new UnsupportedOperationException(
38
- "This is a utility class and cannot be instantiated");
39
- }
40
-
41
- /**
42
- * Create a {@link net.kyori.adventure.text.minimessage.Template} from a PlotSquared {@link Caption}
43
- *
44
- * @param localeHolder Locale holder
45
- * @param key Template key
46
- * @param caption Caption object
47
- * @param replacements Replacements
48
- * @return Generated template
49
- */
50
- public static @NonNull Template of(
51
- final @NonNull LocaleHolder localeHolder,
52
- final @NonNull String key, final @NonNull Caption caption,
53
- final @NonNull Template... replacements
54
- ) {
55
- return Template.of(key, MINI_MESSAGE.parse(caption.getComponent(localeHolder), replacements));
56
- }
57
-
58
- /**
59
- * Create a {@link Template} from a username (using UUID mappings)
60
- *
61
- * @param key Template key
62
- * @param uuid Player UUID
63
- * @return Generated template
64
- */
65
- public static @NonNull Template of(final @NonNull String key, final @NonNull UUID uuid) {
66
- final String username = PlayerManager.resolveName(uuid).getComponent(LocaleHolder.console());
67
- return Template.of(key, username);
68
- }
69
-
70
- /**
71
- * Create a {@link Template} from a string
72
- *
73
- * @param key Template key
74
- * @param value Template value
75
- * @return Generated template
76
- */
77
- public static @NonNull Template of(final @NonNull String key, final @NonNull String value) {
78
- return Template.of(key, value);
79
- }
80
-
81
- /**
82
- * Create a {@link Template} from a plot area
83
- *
84
- * @param key Template Key
85
- * @param area Plot area
86
- * @return Generated template
87
- */
88
- public static @NonNull Template of(final @NonNull String key, final @NonNull PlotArea area) {
89
- return Template.of(key, area.toString());
90
- }
91
-
92
- /**
93
- * Create a {@link Template} from a number
94
- *
95
- * @param key Template key
96
- * @param number Number
97
- * @return Generated template
98
- */
99
- public static @NonNull Template of(final @NonNull String key, final @NonNull Number number) {
100
- return Template.of(key, number.toString());
101
- }
102
-
103
- }
Core/src/main/java/com/plotsquared/core/configuration/caption/TranslatableCaption.java CHANGED
@@ -20,6 +20,10 @@ package com.plotsquared.core.configuration.caption;
20
20
 
21
21
  import com.google.common.base.Objects;
22
22
  import com.plotsquared.core.PlotSquared;
23
+ import net.kyori.adventure.text.Component;
24
+ import net.kyori.adventure.text.minimessage.MiniMessage;
25
+ import net.kyori.adventure.text.minimessage.tag.Tag;
26
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
23
27
  import org.checkerframework.checker.nullness.qual.NonNull;
24
28
 
25
29
  import java.util.Locale;
@@ -89,6 +93,17 @@ public final class TranslatableCaption implements NamespacedCaption {
89
93
  return PlotSquared.get().getCaptionMap(this.namespace).getMessage(this, localeHolder);
90
94
  }
91
95
 
96
+ @Override
97
+ public @NonNull Component toComponent(@NonNull final LocaleHolder localeHolder) {
98
+ if (getKey().equals("core.prefix")) {
99
+ return MiniMessage.miniMessage().deserialize(getComponent(localeHolder));
100
+ }
101
+ return MiniMessage.miniMessage().deserialize(getComponent(localeHolder), TagResolver.resolver(
102
+ "prefix",
103
+ Tag.inserting(TranslatableCaption.of("core.prefix").toComponent(localeHolder))
104
+ ));
105
+ }
106
+
92
107
  @Override
93
108
  public @NonNull String getKey() {
94
109
  return this.key;
Core/src/main/java/com/plotsquared/core/events/PlayerAutoPlotEvent.java CHANGED
@@ -105,38 +105,6 @@ public class PlayerAutoPlotEvent extends PlotEvent implements CancellablePlotEve
105
105
  return this.plotArea;
106
106
  }
107
107
 
108
- /**
109
- * @deprecated for removal. Use {@link PlayerAutoPlotEvent#getSizeX()}
110
- */
111
- @Deprecated(forRemoval = true, since = "6.1.0")
112
- public int getSize_x() {
113
- return getSizeX();
114
- }
115
-
116
- /**
117
- * @deprecated for removal. Use {@link PlayerAutoPlotEvent#setSizeX(int)}
118
- */
119
- @Deprecated(forRemoval = true, since = "6.1.0")
120
- public void setSize_x(int sizeX) {
121
- setSizeX(sizeX);
122
- }
123
-
124
- /**
125
- * @deprecated for removal. Use {@link PlayerAutoPlotEvent#getSizeZ()}
126
- */
127
- @Deprecated(forRemoval = true, since = "6.1.0")
128
- public int getSize_z() {
129
- return getSizeZ();
130
- }
131
-
132
- /**
133
- * @deprecated for removal. Use {@link PlayerAutoPlotEvent#setSizeZ(int)}
134
- */
135
- @Deprecated(forRemoval = true, since = "6.1.0")
136
- public void setSize_z(int sizeZ) {
137
- setSizeZ(sizeZ);
138
- }
139
-
140
108
  /**
141
109
  * Get the x size of the auto-area
142
110
  *
Core/src/main/java/com/plotsquared/core/events/PlayerTeleportToPlotEvent.java CHANGED
@@ -31,15 +31,6 @@ public class PlayerTeleportToPlotEvent extends PlotPlayerEvent implements Cancel
31
31
  private final TeleportCause cause;
32
32
  private Result eventResult;
33
33
 
34
- /**
35
- * @deprecated use {@link PlayerTeleportToPlotEvent#PlayerTeleportToPlotEvent(PlotPlayer, Location, Plot, TeleportCause)}.
36
- * You should not be creating events in the first place.
37
- */
38
- @Deprecated(forRemoval = true, since = "6.1.0")
39
- public PlayerTeleportToPlotEvent(PlotPlayer<?> player, Location from, Plot plot) {
40
- this(player, from, plot, TeleportCause.UNKNOWN);
41
- }
42
-
43
34
  /**
44
35
  * PlayerTeleportToPlotEvent: Called when a player teleports to a plot
45
36
  *
Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java CHANGED
@@ -27,7 +27,7 @@ import com.plotsquared.core.plot.PlotManager;
27
27
  import com.plotsquared.core.queue.AreaBoundDelegateQueueCoordinator;
28
28
  import com.plotsquared.core.queue.LocationOffsetDelegateQueueCoordinator;
29
29
  import com.plotsquared.core.queue.QueueCoordinator;
30
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
30
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
31
31
  import com.plotsquared.core.util.RegionUtil;
32
32
  import com.sk89q.worldedit.regions.CuboidRegion;
33
33
  import com.sk89q.worldedit.world.block.BlockState;
@@ -161,13 +161,13 @@ public class AugmentedUtils {
161
161
 
162
162
  // This queue should not be enqueued as it is simply used to restrict block setting, and then delegate to the
163
163
  // actual queue
164
- ScopedQueueCoordinator scoped =
165
- new ScopedQueueCoordinator(
164
+ ZeroedDelegateScopedQueueCoordinator scoped =
165
+ new ZeroedDelegateScopedQueueCoordinator(
166
166
  secondaryMask,
167
167
  Location.at(world, blockX, area.getMinGenHeight(), blockZ),
168
168
  Location.at(world, blockX + 15, area.getMaxGenHeight(), blockZ + 15)
169
169
  );
170
- generator.generateChunk(scoped, area);
170
+ generator.generateChunk(scoped, area, true);
171
171
  generator.populateChunk(scoped, area);
172
172
  }
173
173
  if (enqueue) {
@@ -176,19 +176,4 @@ public class AugmentedUtils {
176
176
  return generationResult;
177
177
  }
178
178
 
179
- /**
180
- * @deprecated Use {@link AugmentedUtils#generateChunk(String, int, int, QueueCoordinator)} as chunkObject is not required
181
- * in the above method
182
- */
183
- @Deprecated(forRemoval = true, since = "6.8.0")
184
- public static boolean generate(
185
- @Nullable Object chunkObject,
186
- final @NonNull String world,
187
- final int chunkX,
188
- final int chunkZ,
189
- QueueCoordinator queue
190
- ) {
191
- return generateChunk(world, chunkX, chunkZ, queue);
192
- }
193
-
194
179
  }
Core/src/main/java/com/plotsquared/core/generator/HybridGen.java CHANGED
@@ -26,7 +26,7 @@ import com.plotsquared.core.inject.factory.HybridPlotWorldFactory;
26
26
  import com.plotsquared.core.location.Location;
27
27
  import com.plotsquared.core.plot.PlotArea;
28
28
  import com.plotsquared.core.plot.PlotId;
29
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
29
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
30
30
  import com.plotsquared.core.util.MathMan;
31
31
  import com.sk89q.worldedit.entity.BaseEntity;
32
32
  import com.sk89q.worldedit.entity.Entity;
@@ -42,6 +42,8 @@ import com.sk89q.worldedit.world.block.BlockTypes;
42
42
  import org.checkerframework.checker.nullness.qual.NonNull;
43
43
  import org.checkerframework.checker.nullness.qual.Nullable;
44
44
 
45
+ import java.util.EnumSet;
46
+
45
47
  public class HybridGen extends IndependentPlotGenerator {
46
48
 
47
49
  private static final CuboidRegion CHUNK = new CuboidRegion(BlockVector3.ZERO, BlockVector3.at(15, 396, 15));
@@ -59,16 +61,16 @@ public class HybridGen extends IndependentPlotGenerator {
59
61
 
60
62
  private void placeSchem(
61
63
  HybridPlotWorld world,
62
- ScopedQueueCoordinator result,
64
+ ZeroedDelegateScopedQueueCoordinator result,
63
65
  short relativeX,
64
66
  short relativeZ,
65
67
  int x,
66
68
  int z,
67
- boolean isRoad,
68
- boolean isPopulating
69
+ EnumSet<SchematicFeature> features
69
70
  ) {
70
71
  int minY; // Math.min(world.PLOT_HEIGHT, world.ROAD_HEIGHT);
71
- if ((isRoad && Settings.Schematics.PASTE_ROAD_ON_TOP) || (!isRoad && Settings.Schematics.PASTE_ON_TOP)) {
72
+ if ((features.contains(SchematicFeature.ROAD) && Settings.Schematics.PASTE_ROAD_ON_TOP)
73
+ || (!features.contains(SchematicFeature.ROAD) && Settings.Schematics.PASTE_ON_TOP)) {
72
74
  minY = world.SCHEM_Y;
73
75
  } else {
74
76
  minY = world.getMinBuildHeight();
@@ -77,12 +79,15 @@ public class HybridGen extends IndependentPlotGenerator {
77
79
  if (blocks != null) {
78
80
  for (int y = 0; y < blocks.length; y++) {
79
81
  if (blocks[y] != null) {
80
- if (!isPopulating || blocks[y].hasNbtData()) {
82
+ if (!features.contains(SchematicFeature.POPULATING) || blocks[y].hasNbtData()) {
81
83
  result.setBlock(x, minY + y, z, blocks[y]);
82
84
  }
83
85
  }
84
86
  }
85
87
  }
88
+ if (!features.contains(SchematicFeature.BIOMES)) {
89
+ return;
90
+ }
86
91
  BiomeType biome = world.G_SCH_B.get(MathMan.pair(relativeX, relativeZ));
87
92
  if (biome != null) {
88
93
  result.setBiome(x, z, biome);
@@ -90,13 +95,15 @@ public class HybridGen extends IndependentPlotGenerator {
90
95
  }
91
96
 
92
97
  @Override
93
- public void generateChunk(@NonNull ScopedQueueCoordinator result, @NonNull PlotArea settings) {
98
+ public void generateChunk(@NonNull ZeroedDelegateScopedQueueCoordinator result, @NonNull PlotArea settings, boolean biomes) {
94
99
  Preconditions.checkNotNull(result, "result cannot be null");
95
100
  Preconditions.checkNotNull(settings, "settings cannot be null");
96
101
 
97
102
  HybridPlotWorld hybridPlotWorld = (HybridPlotWorld) settings;
98
103
  // Biome
99
- result.fillBiome(hybridPlotWorld.getPlotBiome());
104
+ if (biomes) {
105
+ result.fillBiome(hybridPlotWorld.getPlotBiome());
106
+ }
100
107
  // Bedrock
101
108
  if (hybridPlotWorld.PLOT_BEDROCK) {
102
109
  for (short x = 0; x < 16; x++) {
@@ -105,26 +112,25 @@ public class HybridGen extends IndependentPlotGenerator {
105
112
  }
106
113
  }
107
114
  }
115
+ EnumSet<SchematicFeature> roadFeatures = EnumSet.of(SchematicFeature.ROAD);
116
+ EnumSet<SchematicFeature> plotFeatures = EnumSet.noneOf(SchematicFeature.class);
117
+ if (biomes) {
118
+ roadFeatures.add(SchematicFeature.BIOMES);
119
+ plotFeatures.add(SchematicFeature.BIOMES);
120
+ }
121
+
108
122
  // Coords
109
123
  Location min = result.getMin();
110
124
  int bx = min.getX() - hybridPlotWorld.ROAD_OFFSET_X;
111
125
  int bz = min.getZ() - hybridPlotWorld.ROAD_OFFSET_Z;
126
+
112
127
  // The relative X-coordinate (within the plot) of the minimum X coordinate
113
128
  // contained in the scoped queue
114
- short relativeOffsetX;
115
- if (bx < 0) {
116
- relativeOffsetX = (short) (hybridPlotWorld.SIZE + (bx % hybridPlotWorld.SIZE));
117
- } else {
118
- relativeOffsetX = (short) (bx % hybridPlotWorld.SIZE);
119
- }
129
+ short relativeOffsetX = (short) Math.floorMod(bx, hybridPlotWorld.SIZE);
120
130
  // The relative Z-coordinate (within the plot) of the minimum Z coordinate
121
131
  // contained in the scoped queue
122
- short relativeOffsetZ;
123
- if (bz < 0) {
124
- relativeOffsetZ = (short) (hybridPlotWorld.SIZE + (bz % hybridPlotWorld.SIZE));
125
- } else {
126
- relativeOffsetZ = (short) (bz % hybridPlotWorld.SIZE);
127
- }
132
+ short relativeOffsetZ = (short) Math.floorMod(bz, hybridPlotWorld.SIZE);
133
+
128
134
  // The X-coordinate of a given X coordinate, relative to the
129
135
  // plot (Counting from the corner with the least positive
130
136
  // coordinates)
@@ -171,7 +177,7 @@ public class HybridGen extends IndependentPlotGenerator {
171
177
  result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
172
178
  }
173
179
  if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
174
- placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true, false);
180
+ placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
175
181
  }
176
182
  }
177
183
  } else if (insideWallX[x]) {
@@ -182,7 +188,7 @@ public class HybridGen extends IndependentPlotGenerator {
182
188
  result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
183
189
  }
184
190
  if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
185
- placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true, false);
191
+ placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
186
192
  }
187
193
  } else {
188
194
  // wall
@@ -194,7 +200,7 @@ public class HybridGen extends IndependentPlotGenerator {
194
200
  result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, hybridPlotWorld.WALL_BLOCK.toPattern());
195
201
  }
196
202
  } else {
197
- placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true, false);
203
+ placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
198
204
  }
199
205
  }
200
206
  }
@@ -206,7 +212,7 @@ public class HybridGen extends IndependentPlotGenerator {
206
212
  result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
207
213
  }
208
214
  if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
209
- placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true, false);
215
+ placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
210
216
  }
211
217
  } else if (insideWallZ[z]) {
212
218
  // wall
@@ -218,7 +224,7 @@ public class HybridGen extends IndependentPlotGenerator {
218
224
  result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, hybridPlotWorld.WALL_BLOCK.toPattern());
219
225
  }
220
226
  } else {
221
- placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true, false);
227
+ placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
222
228
  }
223
229
  } else {
224
230
  // plot
@@ -227,7 +233,7 @@ public class HybridGen extends IndependentPlotGenerator {
227
233
  }
228
234
  result.setBlock(x, hybridPlotWorld.PLOT_HEIGHT, z, hybridPlotWorld.TOP_BLOCK.toPattern());
229
235
  if (hybridPlotWorld.PLOT_SCHEMATIC) {
230
- placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, false, false);
236
+ placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, plotFeatures);
231
237
  }
232
238
  }
233
239
  }
@@ -236,31 +242,26 @@ public class HybridGen extends IndependentPlotGenerator {
236
242
  }
237
243
 
238
244
  @Override
239
- public boolean populateChunk(final ScopedQueueCoordinator result, final PlotArea settings) {
245
+ public void populateChunk(final ZeroedDelegateScopedQueueCoordinator result, final PlotArea settings) {
240
246
  HybridPlotWorld hybridPlotWorld = (HybridPlotWorld) settings;
241
247
  if (!hybridPlotWorld.populationNeeded()) {
242
- return false;
248
+ return;
243
249
  }
250
+ EnumSet<SchematicFeature> roadFeatures = EnumSet.of(SchematicFeature.POPULATING, SchematicFeature.ROAD);
251
+ EnumSet<SchematicFeature> plotFeatures = EnumSet.of(SchematicFeature.POPULATING);
252
+
244
253
  // Coords
245
254
  Location min = result.getMin();
246
255
  int bx = min.getX() - hybridPlotWorld.ROAD_OFFSET_X;
247
256
  int bz = min.getZ() - hybridPlotWorld.ROAD_OFFSET_Z;
257
+
248
258
  // The relative X-coordinate (within the plot) of the minimum X coordinate
249
259
  // contained in the scoped queue
250
- short relativeOffsetX;
251
- if (bx < 0) {
252
- relativeOffsetX = (short) (hybridPlotWorld.SIZE + (bx % hybridPlotWorld.SIZE));
253
- } else {
254
- relativeOffsetX = (short) (bx % hybridPlotWorld.SIZE);
255
- }
260
+ short relativeOffsetX = (short) Math.floorMod(bx, hybridPlotWorld.SIZE);
256
261
  // The relative Z-coordinate (within the plot) of the minimum Z coordinate
257
262
  // contained in the scoped queue
258
- short relativeOffsetZ;
259
- if (bz < 0) {
260
- relativeOffsetZ = (short) (hybridPlotWorld.SIZE + (bz % hybridPlotWorld.SIZE));
261
- } else {
262
- relativeOffsetZ = (short) (bz % hybridPlotWorld.SIZE);
263
- }
263
+ short relativeOffsetZ = (short) Math.floorMod(bz, hybridPlotWorld.SIZE);
264
+
264
265
  boolean allRoad = true;
265
266
  boolean overlap = false;
266
267
 
@@ -313,17 +314,17 @@ public class HybridGen extends IndependentPlotGenerator {
313
314
  if (insideRoadX[x] || insideWallX[x]) {
314
315
  if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
315
316
  for (short z = 0; z < 16; z++) {
316
- placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true, true);
317
+ placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
317
318
  }
318
319
  }
319
320
  } else {
320
321
  for (short z = 0; z < 16; z++) {
321
322
  if (insideRoadZ[z] || insideWallZ[z]) {
322
323
  if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
323
- placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true, true);
324
+ placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
324
325
  }
325
326
  } else if (hybridPlotWorld.PLOT_SCHEMATIC) {
326
- placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, false, true);
327
+ placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, plotFeatures);
327
328
  }
328
329
  }
329
330
  }
@@ -364,7 +365,7 @@ public class HybridGen extends IndependentPlotGenerator {
364
365
  }
365
366
  }
366
367
  }
367
- return true;
368
+ return;
368
369
  }
369
370
 
370
371
  @Override
@@ -377,6 +378,27 @@ public class HybridGen extends IndependentPlotGenerator {
377
378
  // All initialization is done in the PlotArea class
378
379
  }
379
380
 
381
+ @Override
382
+ public BiomeType getBiome(final PlotArea settings, final int worldX, final int worldY, final int worldZ) {
383
+ HybridPlotWorld hybridPlotWorld = (HybridPlotWorld) settings;
384
+ if (!hybridPlotWorld.PLOT_SCHEMATIC && !hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
385
+ return hybridPlotWorld.getPlotBiome();
386
+ }
387
+ int relativeX = worldX;
388
+ int relativeZ = worldZ;
389
+ if (hybridPlotWorld.ROAD_OFFSET_X != 0) {
390
+ relativeX -= hybridPlotWorld.ROAD_OFFSET_X;
391
+ }
392
+ if (hybridPlotWorld.ROAD_OFFSET_Z != 0) {
393
+ relativeZ -= hybridPlotWorld.ROAD_OFFSET_Z;
394
+ }
395
+ int size = hybridPlotWorld.PLOT_WIDTH + hybridPlotWorld.ROAD_WIDTH;
396
+ relativeX = Math.floorMod(relativeX, size);
397
+ relativeZ = Math.floorMod(relativeZ, size);
398
+ BiomeType biome = hybridPlotWorld.G_SCH_B.get(MathMan.pair((short) relativeX, (short) relativeZ));
399
+ return biome == null ? hybridPlotWorld.getPlotBiome() : biome;
400
+ }
401
+
380
402
  /**
381
403
  * Wrapper to allow a WorldEdit {@link Entity} to effectively have a mutable location as the location in its NBT should be changed
382
404
  * when set to the world.
@@ -431,4 +453,10 @@ public class HybridGen extends IndependentPlotGenerator {
431
453
 
432
454
  }
433
455
 
456
+ private enum SchematicFeature {
457
+ BIOMES,
458
+ ROAD,
459
+ POPULATING
460
+ }
461
+
434
462
  }
Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java CHANGED
@@ -68,8 +68,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
68
68
  private static final AffineTransform transform = new AffineTransform().rotateY(90);
69
69
  public boolean ROAD_SCHEMATIC_ENABLED;
70
70
  public boolean PLOT_SCHEMATIC = false;
71
- @Deprecated(forRemoval = true, since = "6.9.0")
72
- public int PLOT_SCHEMATIC_HEIGHT = -1;
73
71
  public short PATH_WIDTH_LOWER;
74
72
  public short PATH_WIDTH_UPPER;
75
73
  public HashMap<Integer, BaseBlock[]> G_SCH;
@@ -104,22 +102,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
104
102
  PlotSquared.platform().injector().injectMembers(this);
105
103
  }
106
104
 
107
- @Deprecated(forRemoval = true, since = "6.9.0")
108
- public static byte wrap(byte data, int start) {
109
- if ((data >= start) && (data < (start + 4))) {
110
- data = (byte) ((((data - start) + 2) & 3) + start);
111
- }
112
- return data;
113
- }
114
-
115
- @Deprecated(forRemoval = true, since = "6.9.0")
116
- public static byte wrap2(byte data, int start) {
117
- if ((data >= start) && (data < (start + 2))) {
118
- data = (byte) ((((data - start) + 1) & 1) + start);
119
- }
120
- return data;
121
- }
122
-
123
105
  public static BaseBlock rotate(BaseBlock id) {
124
106
 
125
107
  CompoundTag tag = id.getNbtData();
@@ -486,11 +468,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
486
468
  }
487
469
  }
488
470
 
489
- /**
490
- * @deprecated This method should not be available for public API usage and will be made private.
491
- */
492
- @Deprecated(forRemoval = true, since = "6.10.2")
493
- public void addOverlayBlock(short x, short y, short z, BaseBlock id, boolean rotate, int height) {
471
+ private void addOverlayBlock(short x, short y, short z, BaseBlock id, boolean rotate, int height) {
494
472
  if (z < 0) {
495
473
  z += this.SIZE;
496
474
  } else if (z >= this.SIZE) {
@@ -521,11 +499,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
521
499
  existing[y] = id;
522
500
  }
523
501
 
524
- /**
525
- * @deprecated This method should not be available for public API usage and will be made private.
526
- */
527
- @Deprecated(forRemoval = true, since = "6.10.2")
528
- public void addOverlayBiome(short x, short z, BiomeType id) {
502
+ private void addOverlayBiome(short x, short z, BiomeType id) {
529
503
  if (z < 0) {
530
504
  z += this.SIZE;
531
505
  } else if (z >= this.SIZE) {
Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java CHANGED
@@ -163,7 +163,7 @@ public class HybridUtils {
163
163
  int relChunkZ = chunkPos.getZ() - cbz;
164
164
  oldBlockQueue.setOffsetX(relChunkX << 4);
165
165
  oldBlockQueue.setOffsetZ(relChunkZ << 4);
166
- hpw.getGenerator().generateChunk(oldBlockQueue, hpw);
166
+ hpw.getGenerator().generateChunk(oldBlockQueue, hpw, false);
167
167
  });
168
168
 
169
169
  final BlockState[][][] oldBlocks = oldBlockQueue.getBlockStates();
@@ -595,20 +595,6 @@ public class HybridUtils {
595
595
  return ey;
596
596
  }
597
597
 
598
- /**
599
- * Regenerate the road in a chunk in a plot area.
600
- *
601
- * @param area Plot area to regenerate road for
602
- * @param chunk Chunk location to regenerate
603
- * @param extend How far to extend setting air above the road
604
- * @return if successful
605
- * @deprecated use {@link HybridUtils#regenerateRoad(PlotArea, BlockVector2, int, QueueCoordinator)}
606
- */
607
- @Deprecated(forRemoval = true, since = "6.6.0")
608
- public boolean regenerateRoad(final PlotArea area, final BlockVector2 chunk, int extend) {
609
- return regenerateRoad(area, chunk, extend, null);
610
- }
611
-
612
598
  /**
613
599
  * Regenerate the road in a chunk in a plot area.
614
600
  *
Core/src/main/java/com/plotsquared/core/generator/IndependentPlotGenerator.java CHANGED
@@ -21,8 +21,9 @@ package com.plotsquared.core.generator;
21
21
  import com.plotsquared.core.PlotSquared;
22
22
  import com.plotsquared.core.plot.PlotArea;
23
23
  import com.plotsquared.core.plot.PlotId;
24
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
24
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
25
25
  import com.plotsquared.core.setup.PlotAreaBuilder;
26
+ import com.sk89q.worldedit.world.biome.BiomeType;
26
27
  import org.checkerframework.checker.nullness.qual.NonNull;
27
28
 
28
29
  /**
@@ -42,25 +43,21 @@ public abstract class IndependentPlotGenerator {
42
43
  /**
43
44
  * Generate chunk block data
44
45
  *
45
- * @param result queue
46
+ * @param result Queue to write to
46
47
  * @param settings PlotArea (settings)
47
- * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
48
+ * @param biomes If biomes should be generated
49
+ * @since TODO
48
50
  */
49
- @Deprecated(forRemoval = true, since = "6.9.0")
50
- public abstract void generateChunk(ScopedQueueCoordinator result, PlotArea settings);
51
+ public abstract void generateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea settings, boolean biomes);
51
52
 
52
53
  /**
53
- * Populates the queue representing a chunk area with tile entities and entities
54
+ * Populate a chunk-queue with tile entities, entities, etc.
54
55
  *
55
- * @param result Queue to write to
56
- * @param settings PlotArea (settings)
57
- * @return True if any population occurred
58
- * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
56
+ * @param result Queue to write to
57
+ * @param setting PlotArea (settings)
58
+ * @since TODO
59
59
  */
60
- @Deprecated(forRemoval = true, since = "6.9.0")
61
- public boolean populateChunk(ScopedQueueCoordinator result, PlotArea settings) {
62
- return false;
63
- }
60
+ public void populateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea setting) {}
64
61
 
65
62
  /**
66
63
  * Return a new PlotArea object.
@@ -102,6 +99,18 @@ public abstract class IndependentPlotGenerator {
102
99
  return (GeneratorWrapper<T>) PlotSquared.platform().wrapPlotGenerator(world, this);
103
100
  }
104
101
 
102
+ /**
103
+ * Get the biome to be generated at a specific point
104
+ *
105
+ * @param settings PlotArea settings to provide biome
106
+ * @param x World x position
107
+ * @param y World y position
108
+ * @param z World z position
109
+ * @return Biome type to be generated
110
+ * @since TODO
111
+ */
112
+ public abstract BiomeType getBiome(PlotArea settings, int x, int y, int z);
113
+
105
114
  @Override
106
115
  public String toString() {
107
116
  return getName();
Core/src/main/java/com/plotsquared/core/generator/SingleWorldGenerator.java CHANGED
@@ -25,8 +25,10 @@ import com.plotsquared.core.plot.PlotId;
25
25
  import com.plotsquared.core.plot.world.PlotAreaManager;
26
26
  import com.plotsquared.core.plot.world.SinglePlotArea;
27
27
  import com.plotsquared.core.plot.world.SinglePlotAreaManager;
28
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
28
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
29
+ import com.sk89q.worldedit.world.biome.BiomeType;
29
30
  import com.sk89q.worldedit.world.biome.BiomeTypes;
31
+ import com.sk89q.worldedit.world.block.BlockState;
30
32
  import com.sk89q.worldedit.world.block.BlockTypes;
31
33
  import org.checkerframework.checker.nullness.qual.NonNull;
32
34
 
@@ -38,6 +40,9 @@ public class SingleWorldGenerator extends IndependentPlotGenerator {
38
40
  private static final Location dirt2 = Location.at("", 15, 2, 15);
39
41
  private static final Location grass1 = Location.at("", 0, 3, 0);
40
42
  private static final Location grass2 = Location.at("", 15, 3, 15);
43
+ private static final BlockState BEDROCK = BlockTypes.BEDROCK.getDefaultState();
44
+ private static final BlockState DIRT = BlockTypes.DIRT.getDefaultState();
45
+ private static final BlockState GRASS_BLOCK = BlockTypes.GRASS_BLOCK.getDefaultState();
41
46
 
42
47
  private final PlotAreaManager plotAreaManager;
43
48
 
@@ -52,19 +57,21 @@ public class SingleWorldGenerator extends IndependentPlotGenerator {
52
57
  }
53
58
 
54
59
  @Override
55
- public void generateChunk(ScopedQueueCoordinator result, PlotArea settings) {
60
+ public void generateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea settings, boolean biomes) {
56
61
  SinglePlotArea area = (SinglePlotArea) settings;
57
62
  if (area.VOID) {
58
63
  Location min = result.getMin();
59
64
  if (min.getX() == 0 && min.getZ() == 0) {
60
- result.setBlock(0, 0, 0, BlockTypes.BEDROCK.getDefaultState());
65
+ result.setBlock(0, 0, 0, BEDROCK);
61
66
  }
62
67
  } else {
63
- result.setCuboid(bedrock1, bedrock2, BlockTypes.BEDROCK.getDefaultState());
64
- result.setCuboid(dirt1, dirt2, BlockTypes.DIRT.getDefaultState());
65
- result.setCuboid(grass1, grass2, BlockTypes.GRASS_BLOCK.getDefaultState());
68
+ result.setCuboid(bedrock1, bedrock2, BEDROCK);
69
+ result.setCuboid(dirt1, dirt2, DIRT);
70
+ result.setCuboid(grass1, grass2, GRASS_BLOCK);
71
+ }
72
+ if (biomes) {
73
+ result.fillBiome(BiomeTypes.PLAINS);
66
74
  }
67
- result.fillBiome(BiomeTypes.PLAINS);
68
75
  }
69
76
 
70
77
  @Override
@@ -76,4 +83,9 @@ public class SingleWorldGenerator extends IndependentPlotGenerator {
76
83
  public void initialize(PlotArea area) {
77
84
  }
78
85
 
86
+ @Override
87
+ public BiomeType getBiome(final PlotArea settings, final int x, final int y, final int z) {
88
+ return BiomeTypes.PLAINS;
89
+ }
90
+
79
91
  }
Core/src/main/java/com/plotsquared/core/listener/PlotListener.java CHANGED
@@ -23,7 +23,6 @@ import com.plotsquared.core.configuration.Settings;
23
23
  import com.plotsquared.core.configuration.caption.Caption;
24
24
  import com.plotsquared.core.configuration.caption.StaticCaption;
25
25
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
26
- import com.plotsquared.core.database.DBFunc;
27
26
  import com.plotsquared.core.events.PlotFlagRemoveEvent;
28
27
  import com.plotsquared.core.events.Result;
29
28
  import com.plotsquared.core.location.Location;
@@ -63,8 +62,11 @@ import com.sk89q.worldedit.world.gamemode.GameMode;
63
62
  import com.sk89q.worldedit.world.gamemode.GameModes;
64
63
  import com.sk89q.worldedit.world.item.ItemType;
65
64
  import com.sk89q.worldedit.world.item.ItemTypes;
65
+ import net.kyori.adventure.text.Component;
66
+ import net.kyori.adventure.text.ComponentLike;
66
67
  import net.kyori.adventure.text.minimessage.MiniMessage;
67
- import net.kyori.adventure.text.minimessage.Template;
68
+ import net.kyori.adventure.text.minimessage.tag.Tag;
69
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
68
70
  import org.checkerframework.checker.nullness.qual.NonNull;
69
71
  import org.checkerframework.checker.nullness.qual.Nullable;
70
72
 
@@ -75,11 +77,10 @@ import java.util.List;
75
77
  import java.util.Map;
76
78
  import java.util.Optional;
77
79
  import java.util.UUID;
78
- import java.util.function.Consumer;
79
80
 
80
81
  public class PlotListener {
81
82
 
82
- private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
83
+ private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
83
84
 
84
85
  private final HashMap<UUID, Interval> feedRunnable = new HashMap<>();
85
86
  private final HashMap<UUID, Interval> healRunnable = new HashMap<>();
@@ -151,7 +152,7 @@ public class PlotListener {
151
152
  if (plot.isDenied(player.getUUID()) && !player.hasPermission("plots.admin.entry.denied")) {
152
153
  player.sendMessage(
153
154
  TranslatableCaption.of("deny.no_enter"),
154
- Template.of("plot", plot.toString())
155
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
155
156
  );
156
157
  return false;
157
158
  }
@@ -219,8 +220,10 @@ public class PlotListener {
219
220
  } else {
220
221
  player.sendMessage(
221
222
  TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
222
- Template.of("gamemode", String.valueOf(gameMode)),
223
- Template.of("plot", plot.getId().toString())
223
+ TagResolver.builder()
224
+ .tag("gamemode", Tag.inserting(Component.text(gameMode.toString())))
225
+ .tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
226
+ .build()
224
227
  );
225
228
  }
226
229
  }
@@ -234,8 +237,10 @@ public class PlotListener {
234
237
  } else {
235
238
  player.sendMessage(
236
239
  TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
237
- Template.of("gamemode", String.valueOf(guestGameMode)),
238
- Template.of("plot", plot.getId().toString())
240
+ TagResolver.builder()
241
+ .tag("gamemode", Tag.inserting(Component.text(guestGameMode.toString())))
242
+ .tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
243
+ .build()
239
244
  );
240
245
  }
241
246
  }
@@ -314,39 +319,21 @@ public class PlotListener {
314
319
  }
315
320
  if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) {
316
321
  final UUID plotOwner = plot.getOwnerAbs();
317
- String owner = PlayerManager.resolveName(plotOwner, true).getComponent(player);
322
+ ComponentLike owner = PlayerManager.resolveName(plotOwner, true).toComponent(player);
318
323
  Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.of("titles" +
319
324
  ".title_entered_plot");
320
325
  Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.of("titles" +
321
326
  ".title_entered_plot_sub");
322
- Template plotTemplate = Template.of("plot", lastPlot.getId().toString());
323
- Template worldTemplate = Template.of("world", player.getLocation().getWorldName());
324
- Template ownerTemplate = Template.of("owner", owner);
325
- Template aliasTemplate = Template.of("alias", plot.getAlias());
326
-
327
- final Consumer<String> userConsumer = user -> {
328
- if (Settings.Titles.TITLES_AS_ACTIONBAR) {
329
- player.sendActionBar(header, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
330
- } else {
331
- player.sendTitle(header, subHeader, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
332
- }
333
- };
334
-
335
- UUID uuid = plot.getOwner();
336
- if (uuid == null) {
337
- userConsumer.accept("Unknown");
338
- } else if (uuid.equals(DBFunc.SERVER)) {
339
- userConsumer.accept(MINI_MESSAGE.stripTokens(TranslatableCaption
340
- .of("info.server")
341
- .getComponent(player)));
327
+ TagResolver resolver = TagResolver.builder()
328
+ .tag("plot", Tag.inserting(Component.text(lastPlot.getId().toString())))
329
+ .tag("world", Tag.inserting(Component.text(player.getLocation().getWorldName())))
330
+ .tag("owner", Tag.inserting(owner))
331
+ .tag("alias", Tag.inserting(Component.text(plot.getAlias())))
332
+ .build();
333
+ if (Settings.Titles.TITLES_AS_ACTIONBAR) {
334
+ player.sendActionBar(header, resolver);
342
335
  } else {
343
- PlotSquared.get().getImpromptuUUIDPipeline().getSingle(plot.getOwner(), (user, throwable) -> {
344
- if (throwable != null) {
345
- userConsumer.accept("Unknown");
346
- } else {
347
- userConsumer.accept(user);
348
- }
349
- });
336
+ player.sendTitle(header, subHeader, resolver);
350
337
  }
351
338
  }
352
339
  }, TaskTime.seconds(1L));
@@ -406,8 +393,10 @@ public class PlotListener {
406
393
  } else {
407
394
  player.sendMessage(
408
395
  TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
409
- Template.of("gamemode", pw.getGameMode().getName().toLowerCase()),
410
- Template.of("plot", plot.toString())
396
+ TagResolver.builder()
397
+ .tag("gamemode", Tag.inserting(Component.text(pw.getGameMode().toString())))
398
+ .tag("plot", Tag.inserting(Component.text(plot.toString())))
399
+ .build()
411
400
  );
412
401
  }
413
402
  }
@@ -477,13 +466,15 @@ public class PlotListener {
477
466
  }
478
467
 
479
468
  private void notifyPlotOwner(final PlotPlayer<?> player, final Plot plot, final PlotPlayer<?> owner, final Caption caption) {
480
- Template playerTemplate = Template.of("player", player.getName());
481
- Template plotTemplate = Template.of("plot", plot.getId().toString());
482
- Template areaTemplate = Template.of("area", plot.getArea().toString());
469
+ TagResolver resolver = TagResolver.builder()
470
+ .tag("player", Tag.inserting(Component.text(player.getName())))
471
+ .tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
472
+ .tag("area", Tag.inserting(Component.text(String.valueOf(plot.getArea()))))
473
+ .build();
483
474
  if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
484
- owner.sendMessage(caption, playerTemplate, plotTemplate, areaTemplate);
475
+ owner.sendMessage(caption, resolver);
485
476
  } else {
486
- owner.sendActionBar(caption, playerTemplate, plotTemplate, areaTemplate);
477
+ owner.sendActionBar(caption, resolver);
487
478
  }
488
479
  }
489
480
 
Core/src/main/java/com/plotsquared/core/listener/WESubscriber.java CHANGED
@@ -38,7 +38,9 @@ import com.sk89q.worldedit.util.Location;
38
38
  import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
39
39
  import com.sk89q.worldedit.util.eventbus.Subscribe;
40
40
  import com.sk89q.worldedit.world.World;
41
- import net.kyori.adventure.text.minimessage.Template;
41
+ import net.kyori.adventure.text.Component;
42
+ import net.kyori.adventure.text.minimessage.tag.Tag;
43
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
42
44
  import org.checkerframework.checker.nullness.qual.NonNull;
43
45
 
44
46
  import java.util.Set;
@@ -94,7 +96,7 @@ public class WESubscriber {
94
96
  if (plotPlayer.hasPermission("plots.worldedit.bypass")) {
95
97
  plotPlayer.sendMessage(
96
98
  TranslatableCaption.of("worldedit.worldedit_bypass"),
97
- Template.of("command", "/plot toggle worldedit")
99
+ TagResolver.resolver("command", Tag.inserting(Component.text("/plot toggle worldedit")))
98
100
  );
99
101
  }
100
102
  if (this.plotAreaManager.hasPlotArea(world)) {
Core/src/main/java/com/plotsquared/core/permissions/Permission.java CHANGED
@@ -18,22 +18,21 @@
18
18
  */
19
19
  package com.plotsquared.core.permissions;
20
20
 
21
+ import net.kyori.adventure.text.Component;
22
+ import net.kyori.adventure.text.ComponentLike;
21
23
  import org.checkerframework.checker.nullness.qual.NonNull;
24
+ import org.jetbrains.annotations.NotNull;
22
25
 
23
26
  /**
24
27
  * Permission class.
25
28
  */
26
- public enum Permission {
29
+ public enum Permission implements ComponentLike {
27
30
 
28
31
  //@formatter:off
29
32
  //<editor-fold desc="Static Permission">
30
33
  PERMISSION_STAR("*"),
31
34
  PERMISSION_ADMIN("plots.admin"),
32
35
  PERMISSION_ADMIN_AREA_SUDO("plots.admin.area.sudo"),
33
- @Deprecated(forRemoval = true, since = "6.2.2")
34
- PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned"),
35
- @Deprecated(forRemoval = true, since = "6.2.2")
36
- PERMISSION_PROJECTILE_OTHER("plots.projectile.other"),
37
36
  PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS("plots.admin.interact.blockedcommands"),
38
37
  PERMISSION_WORLDEDIT_BYPASS("plots.worldedit.bypass"),
39
38
  PERMISSION_PLOT_TOGGLE_TITLES("plots.toggle.titles"),
@@ -219,4 +218,9 @@ public enum Permission {
219
218
  return String.format(this.toString(), replacements);
220
219
  }
221
220
 
221
+ @Override
222
+ public @NotNull Component asComponent() {
223
+ return Component.text(text);
224
+ }
225
+
222
226
  }
Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java CHANGED
@@ -42,7 +42,7 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
42
42
  import com.sk89q.worldedit.world.item.ItemType;
43
43
  import net.kyori.adventure.audience.Audience;
44
44
  import net.kyori.adventure.text.minimessage.MiniMessage;
45
- import net.kyori.adventure.text.minimessage.Template;
45
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
46
46
  import org.checkerframework.checker.nullness.qual.NonNull;
47
47
 
48
48
  import java.util.UUID;
@@ -110,7 +110,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
110
110
  @Override
111
111
  public void sendTitle(
112
112
  final @NonNull Caption title, final @NonNull Caption subtitle,
113
- final int fadeIn, final int stay, final int fadeOut, final @NonNull Template... replacements
113
+ final int fadeIn, final int stay, final int fadeOut, final @NonNull TagResolver... resolvers
114
114
  ) {
115
115
  }
116
116
 
@@ -144,7 +144,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
144
144
  @Override
145
145
  public void sendMessage(
146
146
  final @NonNull Caption caption,
147
- final @NonNull Template... replacements
147
+ final @NonNull TagResolver... replacements
148
148
  ) {
149
149
  String message = caption.getComponent(this);
150
150
  if (message.isEmpty()) {
@@ -154,7 +154,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
154
154
  .replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&')
155
155
  .replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this));
156
156
  // Parse the message
157
- PlotSquared.platform().consoleAudience().sendMessage(MINI_MESSAGE.parse(message, replacements));
157
+ PlotSquared.platform().consoleAudience().sendMessage(MINI_MESSAGE.deserialize(message, replacements));
158
158
  }
159
159
 
160
160
  @Override
Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java CHANGED
@@ -57,7 +57,8 @@ import com.sk89q.worldedit.world.item.ItemType;
57
57
  import net.kyori.adventure.audience.Audience;
58
58
  import net.kyori.adventure.text.Component;
59
59
  import net.kyori.adventure.text.minimessage.MiniMessage;
60
- import net.kyori.adventure.text.minimessage.Template;
60
+ import net.kyori.adventure.text.minimessage.tag.Tag;
61
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
61
62
  import net.kyori.adventure.title.Title;
62
63
  import org.apache.logging.log4j.LogManager;
63
64
  import org.apache.logging.log4j.Logger;
@@ -205,7 +206,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
205
206
  if (notify) {
206
207
  sendMessage(
207
208
  TranslatableCaption.of("permission.no_permission_event"),
208
- Template.of("node", permission)
209
+ TagResolver.resolver("node", Tag.inserting(Component.text(permission)))
209
210
  );
210
211
  }
211
212
  return false;
@@ -849,7 +850,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
849
850
  */
850
851
  public void sendTitle(
851
852
  final @NonNull Caption title, final @NonNull Caption subtitle,
852
- final @NonNull Template... replacements
853
+ final @NonNull TagResolver... replacements
853
854
  ) {
854
855
  sendTitle(
855
856
  title,
@@ -874,11 +875,11 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
874
875
  public void sendTitle(
875
876
  final @NonNull Caption title, final @NonNull Caption subtitle,
876
877
  final int fadeIn, final int stay, final int fadeOut,
877
- final @NonNull Template... replacements
878
+ final @NonNull TagResolver... replacements
878
879
  ) {
879
- final Component titleComponent = MiniMessage.get().parse(title.getComponent(this), replacements);
880
+ final Component titleComponent = MiniMessage.miniMessage().deserialize(title.getComponent(this), replacements);
880
881
  final Component subtitleComponent =
881
- MiniMessage.get().parse(subtitle.getComponent(this), replacements);
882
+ MiniMessage.miniMessage().deserialize(subtitle.getComponent(this), replacements);
882
883
  final Title.Times times = Title.Times.of(
883
884
  Duration.of(Settings.Titles.TITLES_FADE_IN * 50L, ChronoUnit.MILLIS),
884
885
  Duration.of(Settings.Titles.TITLES_STAY * 50L, ChronoUnit.MILLIS),
@@ -896,7 +897,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
896
897
  */
897
898
  public void sendActionBar(
898
899
  final @NonNull Caption caption,
899
- final @NonNull Template... replacements
900
+ final @NonNull TagResolver... replacements
900
901
  ) {
901
902
  String message;
902
903
  try {
@@ -916,14 +917,14 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
916
917
  .replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this));
917
918
 
918
919
 
919
- final Component component = MiniMessage.get().parse(message, replacements);
920
+ final Component component = MiniMessage.miniMessage().deserialize(message, replacements);
920
921
  getAudience().sendActionBar(component);
921
922
  }
922
923
 
923
924
  @Override
924
925
  public void sendMessage(
925
926
  final @NonNull Caption caption,
926
- final @NonNull Template... replacements
927
+ final @NonNull TagResolver... replacements
927
928
  ) {
928
929
  String message;
929
930
  try {
@@ -942,7 +943,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
942
943
  .replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&')
943
944
  .replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this));
944
945
  // Parse the message
945
- final Component component = MiniMessage.get().parse(message, replacements);
946
+ final Component component = MiniMessage.miniMessage().deserialize(message, replacements);
946
947
  if (!Objects.equal(component, this.getMeta("lastMessage"))
947
948
  || System.currentTimeMillis() - this.<Long>getMeta("lastMessageTime") > 5000) {
948
949
  setMeta("lastMessage", component);
Core/src/main/java/com/plotsquared/core/plot/BlockBucket.java CHANGED
@@ -110,54 +110,62 @@ public final class BlockBucket implements ConfigurationSerializable {
110
110
  if (isCompiled()) {
111
111
  return;
112
112
  }
113
- this.compiled = true;
114
- String string = this.input.toString();
115
- if (string.isEmpty()) {
116
- this.single = null;
117
- this.pattern = null;
118
- return;
119
- }
120
- // Convert legacy format
121
- boolean legacy = false;
122
- String[] blocksStr = string.split(",(?![^\\(\\[]*[\\]\\)])");
123
- if (blocksStr.length == 1) {
124
- try {
125
- Matcher matcher = regex.matcher(string);
113
+ // Synchronized as BlockBuckets may require compilation asynchronously due to async chunk generation on Paper servers
114
+ synchronized (this) {
115
+ if (isCompiled()) {
116
+ return;
117
+ }
118
+ String string = this.input.toString();
119
+ if (string.isEmpty()) {
120
+ this.single = null;
121
+ this.pattern = null;
122
+ this.compiled = true;
123
+ return;
124
+ }
125
+ // Convert legacy format
126
+ boolean legacy = false;
127
+ String[] blocksStr = string.split(",(?![^\\(\\[]*[\\]\\)])");
128
+ if (blocksStr.length == 1) {
129
+ try {
130
+ Matcher matcher = regex.matcher(string);
131
+ if (matcher.find()) {
132
+ String chanceStr = matcher.group("chance");
133
+ String block = matcher.group("block");
134
+ //noinspection PointlessNullCheck
135
+ if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan
136
+ .isInteger(chanceStr)) {
137
+ String namespace = matcher.group("namespace");
138
+ string = (namespace == null ? "" : namespace + ":") + block;
139
+ }
140
+ }
141
+ this.single = BlockUtil.get(string);
142
+ this.pattern = new BlockPattern(single);
143
+ this.compiled = true;
144
+ return;
145
+ } catch (Exception ignore) {
146
+ }
147
+ }
148
+ for (int i = 0; i < blocksStr.length; i++) {
149
+ String entry = blocksStr[i];
150
+ Matcher matcher = regex.matcher(entry);
126
151
  if (matcher.find()) {
127
152
  String chanceStr = matcher.group("chance");
128
- String block = matcher.group("block");
129
153
  //noinspection PointlessNullCheck
130
- if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan
131
- .isInteger(chanceStr)) {
132
- String namespace = matcher.group("namespace");
133
- string = (namespace == null ? "" : namespace + ":") + block;
154
+ if (chanceStr != null && MathMan.isInteger(chanceStr)) {
155
+ String[] parts = entry.split(":");
156
+ parts = Arrays.copyOf(parts, parts.length - 1);
157
+ entry = chanceStr + "%" + StringMan.join(parts, ":");
158
+ blocksStr[i] = entry;
159
+ legacy = true;
134
160
  }
135
161
  }
136
- this.single = BlockUtil.get(string);
137
- this.pattern = new BlockPattern(single);
138
- return;
139
- } catch (Exception ignore) {
140
162
  }
141
- }
142
- for (int i = 0; i < blocksStr.length; i++) {
143
- String entry = blocksStr[i];
144
- Matcher matcher = regex.matcher(entry);
145
- if (matcher.find()) {
146
- String chanceStr = matcher.group("chance");
147
- //noinspection PointlessNullCheck
148
- if (chanceStr != null && MathMan.isInteger(chanceStr)) {
149
- String[] parts = entry.split(":");
150
- parts = Arrays.copyOf(parts, parts.length - 1);
151
- entry = chanceStr + "%" + StringMan.join(parts, ":");
152
- blocksStr[i] = entry;
153
- legacy = true;
154
- }
163
+ if (legacy) {
164
+ string = StringMan.join(blocksStr, ",");
155
165
  }
166
+ pattern = PatternUtil.parse(null, string);
167
+ this.compiled = true;
156
168
  }
157
- if (legacy) {
158
- string = StringMan.join(blocksStr, ",");
159
- }
160
- pattern = PatternUtil.parse(null, string);
161
169
  }
162
170
 
163
171
  public boolean isCompiled() {
Core/src/main/java/com/plotsquared/core/plot/Plot.java CHANGED
@@ -40,6 +40,7 @@ import com.plotsquared.core.location.Location;
40
40
  import com.plotsquared.core.permissions.Permission;
41
41
  import com.plotsquared.core.player.ConsolePlayer;
42
42
  import com.plotsquared.core.player.PlotPlayer;
43
+ import com.plotsquared.core.plot.expiration.ExpireManager;
43
44
  import com.plotsquared.core.plot.expiration.PlotAnalysis;
44
45
  import com.plotsquared.core.plot.flag.FlagContainer;
45
46
  import com.plotsquared.core.plot.flag.GlobalFlagContainer;
@@ -68,9 +69,11 @@ import com.sk89q.worldedit.math.BlockVector3;
68
69
  import com.sk89q.worldedit.regions.CuboidRegion;
69
70
  import com.sk89q.worldedit.world.biome.BiomeType;
70
71
  import net.kyori.adventure.text.Component;
72
+ import net.kyori.adventure.text.ComponentLike;
71
73
  import net.kyori.adventure.text.TextComponent;
72
74
  import net.kyori.adventure.text.minimessage.MiniMessage;
73
- import net.kyori.adventure.text.minimessage.Template;
75
+ import net.kyori.adventure.text.minimessage.tag.Tag;
76
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
74
77
  import org.apache.logging.log4j.LogManager;
75
78
  import org.apache.logging.log4j.Logger;
76
79
  import org.checkerframework.checker.nullness.qual.NonNull;
@@ -113,9 +116,6 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
113
116
  */
114
117
  public class Plot {
115
118
 
116
- @Deprecated(forRemoval = true, since = "6.6.0")
117
- public static final int MAX_HEIGHT = 256;
118
-
119
119
  private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Plot.class.getSimpleName());
120
120
  private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
121
121
  private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
@@ -1691,19 +1691,6 @@ public class Plot {
1691
1691
  return base.settings != null && base.settings.getRatings() != null;
1692
1692
  }
1693
1693
 
1694
- @Deprecated(forRemoval = true, since = "6.1.0")
1695
- public boolean claim(final @NonNull PlotPlayer<?> player, boolean teleport, String schematic) {
1696
- if (!canClaim(player)) {
1697
- return false;
1698
- }
1699
- return claim(player, teleport, schematic, true);
1700
- }
1701
-
1702
- @Deprecated(forRemoval = true, since = "6.1.0")
1703
- public boolean claim(final @NonNull PlotPlayer<?> player, boolean teleport, String schematic, boolean updateDB) {
1704
- return claim(player, teleport, schematic, updateDB, false);
1705
- }
1706
-
1707
1694
  /**
1708
1695
  * Claim the plot
1709
1696
  *
@@ -1731,7 +1718,10 @@ public class Plot {
1731
1718
  area.addPlot(this);
1732
1719
  updateWorldBorder();
1733
1720
  }
1734
- player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("plot", this.getId().toString()));
1721
+ player.sendMessage(
1722
+ TranslatableCaption.of("working.claimed"),
1723
+ TagResolver.resolver("plot", Tag.inserting(Component.text(this.getId().toString())))
1724
+ );
1735
1725
  if (teleport) {
1736
1726
  if (!auto && Settings.Teleport.ON_CLAIM) {
1737
1727
  teleportPlayer(player, TeleportCause.COMMAND_CLAIM, result -> {
@@ -2594,11 +2584,13 @@ public class Plot {
2594
2584
  return;
2595
2585
  }
2596
2586
  Caption caption = TranslatableCaption.of("debug.plot_debug");
2597
- Template plotTemplate = Template.of("plot", this.toString());
2598
- Template messageTemplate = Template.of("message", message);
2587
+ TagResolver resolver = TagResolver.builder()
2588
+ .tag("plot", Tag.inserting(Component.text(toString())))
2589
+ .tag("message", Tag.inserting(Component.text(message)))
2590
+ .build();
2599
2591
  for (final PlotPlayer<?> player : players) {
2600
2592
  if (isOwner(player.getUUID()) || player.hasPermission(Permission.PERMISSION_ADMIN_DEBUG_OTHER)) {
2601
- player.sendMessage(caption, plotTemplate, messageTemplate);
2593
+ player.sendMessage(caption, resolver);
2602
2594
  }
2603
2595
  }
2604
2596
  } catch (final Exception ignored) {
@@ -2628,7 +2620,7 @@ public class Plot {
2628
2620
  if (result == Result.DENY) {
2629
2621
  player.sendMessage(
2630
2622
  TranslatableCaption.of("events.event_denied"),
2631
- Template.of("value", "Teleport")
2623
+ TagResolver.resolver("value", Tag.inserting(Component.text("Teleport")))
2632
2624
  );
2633
2625
  resultConsumer.accept(false);
2634
2626
  return;
@@ -2642,7 +2634,7 @@ public class Plot {
2642
2634
  }
2643
2635
  player.sendMessage(
2644
2636
  TranslatableCaption.of("teleport.teleport_in_seconds"),
2645
- Template.of("amount", String.valueOf(Settings.Teleport.DELAY))
2637
+ TagResolver.resolver("amount", Tag.inserting(Component.text(Settings.Teleport.DELAY)))
2646
2638
  );
2647
2639
  final String name = player.getName();
2648
2640
  TaskManager.addToTeleportQueue(name);
@@ -2818,41 +2810,45 @@ public class Plot {
2818
2810
  public CompletableFuture<Caption> format(final Caption iInfo, PlotPlayer<?> player, final boolean full) {
2819
2811
  final CompletableFuture<Caption> future = new CompletableFuture<>();
2820
2812
  int num = this.getConnectedPlots().size();
2821
- String alias = !this.getAlias().isEmpty() ? this.getAlias() : TranslatableCaption.of("info.none").getComponent(player);
2813
+ ComponentLike alias = !this.getAlias().isEmpty() ?
2814
+ Component.text(this.getAlias()) :
2815
+ TranslatableCaption.of("info.none").toComponent(player);
2822
2816
  Location bot = this.getCorners()[0];
2823
2817
  PlotSquared.platform().worldUtil().getBiome(
2824
2818
  Objects.requireNonNull(this.getWorldName()),
2825
2819
  bot.getX(),
2826
2820
  bot.getZ(),
2827
2821
  biome -> {
2828
- Component trusted = PlayerManager.getPlayerList(this.getTrusted(), player);
2829
- Component members = PlayerManager.getPlayerList(this.getMembers(), player);
2830
- Component denied = PlayerManager.getPlayerList(this.getDenied(), player);
2831
- String seen;
2832
- if (Settings.Enabled_Components.PLOT_EXPIRY && PlotSquared.platform().expireManager() != null) {
2822
+ ComponentLike trusted = PlayerManager.getPlayerList(this.getTrusted(), player);
2823
+ ComponentLike members = PlayerManager.getPlayerList(this.getMembers(), player);
2824
+ ComponentLike denied = PlayerManager.getPlayerList(this.getDenied(), player);
2825
+ ComponentLike seen;
2826
+ ExpireManager expireManager = PlotSquared.platform().expireManager();
2827
+ if (Settings.Enabled_Components.PLOT_EXPIRY && expireManager != null) {
2833
2828
  if (this.isOnline()) {
2834
- seen = TranslatableCaption.of("info.now").getComponent(player);
2829
+ seen = TranslatableCaption.of("info.now").toComponent(player);
2835
2830
  } else {
2836
2831
  int time = (int) (PlotSquared.platform().expireManager().getAge(this, false) / 1000);
2837
2832
  if (time != 0) {
2838
- seen = TimeUtil.secToTime(time);
2833
+ seen = Component.text(TimeUtil.secToTime(time));
2839
2834
  } else {
2840
- seen = TranslatableCaption.of("info.unknown").getComponent(player);
2835
+ seen = TranslatableCaption.of("info.unknown").toComponent(player);
2841
2836
  }
2842
2837
  }
2843
2838
  } else {
2844
- seen = TranslatableCaption.of("info.never").getComponent(player);
2839
+ seen = TranslatableCaption.of("info.never").toComponent(player);
2845
2840
  }
2846
2841
 
2847
- String description = this.getFlag(DescriptionFlag.class);
2848
- if (description.isEmpty()) {
2849
- description = TranslatableCaption.of("info.plot_no_description").getComponent(player);
2842
+ ComponentLike description = TranslatableCaption.of("info.plot_no_description").toComponent(player);
2843
+ String descriptionValue = this.getFlag(DescriptionFlag.class);
2844
+ if (!descriptionValue.isEmpty()) {
2845
+ description = Component.text(descriptionValue);
2850
2846
  }
2851
2847
 
2852
- Component flags;
2848
+ ComponentLike flags;
2853
2849
  Collection<PlotFlag<?, ?>> flagCollection = this.getApplicableFlags(true);
2854
2850
  if (flagCollection.isEmpty()) {
2855
- flags = MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(player));
2851
+ flags = TranslatableCaption.of("info.none").toComponent(player);
2856
2852
  } else {
2857
2853
  TextComponent.Builder flagBuilder = Component.text();
2858
2854
  String prefix = "";
@@ -2863,13 +2859,18 @@ public class Plot {
2863
2859
  } else {
2864
2860
  value = flag.toString();
2865
2861
  }
2866
- Component snip = MINI_MESSAGE.parse(
2862
+ Component snip = MINI_MESSAGE.deserialize(
2867
2863
  prefix + CaptionUtility.format(
2868
2864
  player,
2869
2865
  TranslatableCaption.of("info.plot_flag_list").getComponent(player)
2870
2866
  ),
2871
- Template.of("flag", flag.getName()),
2872
- Template.of("value", CaptionUtility.formatRaw(player, value.toString()))
2867
+ TagResolver.builder()
2868
+ .tag("flag", Tag.inserting(Component.text(flag.getName())))
2869
+ .tag("value", Tag.inserting(Component.text(CaptionUtility.formatRaw(
2870
+ player,
2871
+ value.toString()
2872
+ ))))
2873
+ .build()
2873
2874
  );
2874
2875
  flagBuilder.append(snip);
2875
2876
  prefix = ", ";
@@ -2881,67 +2882,57 @@ public class Plot {
2881
2882
  if (this.getOwner() == null) {
2882
2883
  owner = Component.text("unowned");
2883
2884
  } else if (this.getOwner().equals(DBFunc.SERVER)) {
2884
- owner = Component.text(MINI_MESSAGE.stripTokens(TranslatableCaption
2885
+ owner = Component.text(MINI_MESSAGE.stripTags(TranslatableCaption
2885
2886
  .of("info.server")
2886
2887
  .getComponent(player)));
2887
2888
  } else {
2888
2889
  owner = PlayerManager.getPlayerList(this.getOwners(), player);
2889
2890
  }
2890
- Template headerTemplate = Template.of(
2891
- "header",
2892
- TranslatableCaption.of("info.plot_info_header").getComponent(player)
2893
- );
2894
- Template footerTemplate = Template.of(
2895
- "footer",
2896
- TranslatableCaption.of("info.plot_info_footer").getComponent(player)
2897
- );
2898
- Template areaTemplate;
2891
+ TagResolver.Builder tagBuilder = TagResolver.builder();
2892
+ tagBuilder.tag("header", Tag.inserting(TranslatableCaption.of("info.plot_info_header").toComponent(player)));
2893
+ tagBuilder.tag("footer", Tag.inserting(TranslatableCaption.of("info.plot_info_footer").toComponent(player)));
2894
+ TextComponent.Builder areaComponent = Component.text();
2899
2895
  if (this.getArea() != null) {
2900
- areaTemplate =
2901
- Template.of(
2902
- "area",
2903
- this.getArea().getWorldName() + (this.getArea().getId() == null
2904
- ? ""
2905
- : "(" + this.getArea().getId() + ")")
2906
- );
2896
+ areaComponent.append(Component.text(getArea().getWorldName()));
2897
+ if (getArea().getId() != null) {
2898
+ areaComponent.append(Component.text("("))
2899
+ .append(Component.text(getArea().getId()))
2900
+ .append(Component.text(")"));
2901
+ }
2907
2902
  } else {
2908
- areaTemplate = Template.of("area", TranslatableCaption.of("info.none").getComponent(player));
2903
+ areaComponent.append(TranslatableCaption.of("info.none").toComponent(player));
2909
2904
  }
2905
+ tagBuilder.tag("area", Tag.inserting(areaComponent));
2910
2906
  long creationDate = Long.parseLong(String.valueOf(timestamp));
2911
2907
  SimpleDateFormat sdf = new SimpleDateFormat(Settings.Timeformat.DATE_FORMAT);
2912
2908
  sdf.setTimeZone(TimeZone.getTimeZone(Settings.Timeformat.TIME_ZONE));
2913
2909
  String newDate = sdf.format(creationDate);
2914
2910
 
2915
- Template idTemplate = Template.of("id", this.getId().toString());
2916
- Template aliasTemplate = Template.of("alias", alias);
2917
- Template numTemplate = Template.of("num", String.valueOf(num));
2918
- Template descTemplate = Template.of("desc", description);
2919
- Template biomeTemplate = Template.of("biome", biome.toString().toLowerCase());
2920
- Template ownerTemplate = Template.of("owner", owner);
2921
- Template membersTemplate = Template.of("members", members);
2922
- Template playerTemplate = Template.of("player", player.getName());
2923
- Template trustedTemplate = Template.of("trusted", trusted);
2924
- Template helpersTemplate = Template.of("helpers", members);
2925
- Template deniedTemplate = Template.of("denied", denied);
2926
- Template seenTemplate = Template.of("seen", seen);
2927
- Template flagsTemplate = Template.of("flags", flags);
2928
- Template creationTemplate = Template.of("creationdate", newDate);
2929
- Template buildTemplate = Template.of("build", String.valueOf(build));
2930
- Template sizeTemplate = Template.of("size", String.valueOf(getConnectedPlots().size()));
2911
+ tagBuilder.tag("id", Tag.inserting(Component.text(getId().toString())));
2912
+ tagBuilder.tag("alias", Tag.inserting(alias));
2913
+ tagBuilder.tag("num", Tag.inserting(Component.text(num)));
2914
+ tagBuilder.tag("desc", Tag.inserting(description));
2915
+ tagBuilder.tag("biome", Tag.inserting(Component.text(biome.toString().toLowerCase())));
2916
+ tagBuilder.tag("owner", Tag.inserting(owner));
2917
+ tagBuilder.tag("members", Tag.inserting(members));
2918
+ tagBuilder.tag("player", Tag.inserting(Component.text(player.getName())));
2919
+ tagBuilder.tag("trusted", Tag.inserting(trusted));
2920
+ tagBuilder.tag("denied", Tag.inserting(denied));
2921
+ tagBuilder.tag("seen", Tag.inserting(seen));
2922
+ tagBuilder.tag("flags", Tag.inserting(flags));
2923
+ tagBuilder.tag("creationdate", Tag.inserting(Component.text(newDate)));
2924
+ tagBuilder.tag("build", Tag.inserting(Component.text(build)));
2925
+ tagBuilder.tag("size", Tag.inserting(Component.text(getConnectedPlots().size())));
2931
2926
  String component = iInfo.getComponent(player);
2932
2927
  if (component.contains("<rating>") || component.contains("<likes>")) {
2933
2928
  TaskManager.runTaskAsync(() -> {
2934
- Template ratingTemplate;
2935
- Template likesTemplate;
2936
2929
  if (Settings.Ratings.USE_LIKES) {
2937
- ratingTemplate = Template.of(
2938
- "rating",
2930
+ tagBuilder.tag("rating", Tag.inserting(Component.text(
2939
2931
  String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
2940
- );
2941
- likesTemplate = Template.of(
2942
- "likes",
2932
+ )));
2933
+ tagBuilder.tag("likes", Tag.inserting(Component.text(
2943
2934
  String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
2944
- );
2935
+ )));
2945
2936
  } else {
2946
2937
  int max = 10;
2947
2938
  if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
@@ -2956,70 +2947,34 @@ public class Plot {
2956
2947
  .append(String.format("%.1f", ratings[i]));
2957
2948
  prefix = ",";
2958
2949
  }
2959
- ratingTemplate = Template.of("rating", rating.toString());
2950
+ tagBuilder.tag("rating", Tag.inserting(Component.text(rating.toString())));
2960
2951
  } else {
2961
2952
  double rating = this.getAverageRating();
2962
2953
  if (Double.isFinite(rating)) {
2963
- ratingTemplate = Template.of("rating", String.format("%.1f", rating) + '/' + max);
2964
- } else {
2965
- ratingTemplate = Template.of(
2954
+ tagBuilder.tag(
2966
2955
  "rating",
2967
- TranslatableCaption.of("info.none").getComponent(player)
2956
+ Tag.inserting(Component.text(String.format("%.1f", rating) + '/' + max))
2957
+ );
2958
+ } else {
2959
+ tagBuilder.tag(
2960
+ "rating", Tag.inserting(TranslatableCaption.of("info.none").toComponent(player))
2968
2961
  );
2969
2962
  }
2970
2963
  }
2971
- likesTemplate = Template.of("likes", "N/A");
2964
+ tagBuilder.tag("likes", Tag.inserting(Component.text("N/A")));
2972
2965
  }
2973
2966
  future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
2974
- .parse(
2967
+ .deserialize(
2975
2968
  iInfo.getComponent(player),
2976
- headerTemplate,
2977
- areaTemplate,
2978
- idTemplate,
2979
- aliasTemplate,
2980
- numTemplate,
2981
- descTemplate,
2982
- biomeTemplate,
2983
- ownerTemplate,
2984
- membersTemplate,
2985
- playerTemplate,
2986
- trustedTemplate,
2987
- helpersTemplate,
2988
- deniedTemplate,
2989
- seenTemplate,
2990
- flagsTemplate,
2991
- buildTemplate,
2992
- ratingTemplate,
2993
- creationTemplate,
2994
- sizeTemplate,
2995
- likesTemplate,
2996
- footerTemplate
2969
+ tagBuilder.build()
2997
2970
  ))));
2998
2971
  });
2999
2972
  return;
3000
2973
  }
3001
2974
  future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
3002
- .parse(
2975
+ .deserialize(
3003
2976
  iInfo.getComponent(player),
3004
- headerTemplate,
3005
- areaTemplate,
3006
- idTemplate,
3007
- aliasTemplate,
3008
- numTemplate,
3009
- descTemplate,
3010
- biomeTemplate,
3011
- ownerTemplate,
3012
- membersTemplate,
3013
- playerTemplate,
3014
- trustedTemplate,
3015
- helpersTemplate,
3016
- deniedTemplate,
3017
- seenTemplate,
3018
- flagsTemplate,
3019
- buildTemplate,
3020
- creationTemplate,
3021
- sizeTemplate,
3022
- footerTemplate
2977
+ tagBuilder.build()
3023
2978
  ))));
3024
2979
  }
3025
2980
  );
Core/src/main/java/com/plotsquared/core/plot/PlotArea.java CHANGED
@@ -35,7 +35,6 @@ import com.plotsquared.core.inject.annotations.WorldConfig;
35
35
  import com.plotsquared.core.location.BlockLoc;
36
36
  import com.plotsquared.core.location.Direction;
37
37
  import com.plotsquared.core.location.Location;
38
- import com.plotsquared.core.location.PlotLoc;
39
38
  import com.plotsquared.core.permissions.Permission;
40
39
  import com.plotsquared.core.player.ConsolePlayer;
41
40
  import com.plotsquared.core.player.MetaDataAccess;
@@ -59,12 +58,16 @@ import com.sk89q.worldedit.world.biome.BiomeType;
59
58
  import com.sk89q.worldedit.world.biome.BiomeTypes;
60
59
  import com.sk89q.worldedit.world.gamemode.GameMode;
61
60
  import com.sk89q.worldedit.world.gamemode.GameModes;
61
+ import net.kyori.adventure.text.Component;
62
+ import net.kyori.adventure.text.ComponentLike;
62
63
  import net.kyori.adventure.text.minimessage.MiniMessage;
63
- import net.kyori.adventure.text.minimessage.Template;
64
+ import net.kyori.adventure.text.minimessage.tag.Tag;
65
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
64
66
  import org.apache.logging.log4j.LogManager;
65
67
  import org.apache.logging.log4j.Logger;
66
68
  import org.checkerframework.checker.nullness.qual.NonNull;
67
69
  import org.checkerframework.checker.nullness.qual.Nullable;
70
+ import org.jetbrains.annotations.NotNull;
68
71
 
69
72
  import java.text.DecimalFormat;
70
73
  import java.util.ArrayList;
@@ -84,7 +87,7 @@ import java.util.function.Consumer;
84
87
  /**
85
88
  * @author Jesse Boyd, Alexander Söderberg
86
89
  */
87
- public abstract class PlotArea {
90
+ public abstract class PlotArea implements ComponentLike {
88
91
 
89
92
  private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotArea.class.getSimpleName());
90
93
  private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
@@ -405,7 +408,7 @@ public abstract class PlotArea {
405
408
  this.getFlagContainer().addAll(parseFlags(flags));
406
409
  ConsolePlayer.getConsole().sendMessage(
407
410
  TranslatableCaption.of("flags.area_flags"),
408
- Template.of("flags", flags.toString())
411
+ TagResolver.resolver("flags", Tag.inserting(Component.text(flags.toString())))
409
412
  );
410
413
 
411
414
  this.spawnEggs = config.getBoolean("event.spawn.egg");
@@ -427,7 +430,7 @@ public abstract class PlotArea {
427
430
  this.getRoadFlagContainer().addAll(parseFlags(roadflags));
428
431
  ConsolePlayer.getConsole().sendMessage(
429
432
  TranslatableCaption.of("flags.road_flags"),
430
- Template.of("flags", roadflags.toString())
433
+ TagResolver.resolver("flags", Tag.inserting(Component.text(roadflags.toString())))
431
434
  );
432
435
 
433
436
  loadConfiguration(config);
@@ -520,6 +523,11 @@ public abstract class PlotArea {
520
523
  }
521
524
  }
522
525
 
526
+ @Override
527
+ public @NotNull Component asComponent() {
528
+ return Component.text(toString());
529
+ }
530
+
523
531
  @Override
524
532
  public int hashCode() {
525
533
  if (this.hash != 0) {
@@ -648,8 +656,10 @@ public abstract class PlotArea {
648
656
  if (!buildRangeContainsY(y) && !player.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
649
657
  player.sendMessage(
650
658
  TranslatableCaption.of("height.height_limit"),
651
- Template.of("minHeight", String.valueOf(minBuildHeight)),
652
- Template.of("maxHeight", String.valueOf(maxBuildHeight))
659
+ TagResolver.builder()
660
+ .tag("minHeight", Tag.inserting(Component.text(minBuildHeight)))
661
+ .tag("maxHeight",
662
+ Tag.inserting(Component.text(maxBuildHeight))).build()
653
663
  );
654
664
  // Return true if "failed" as the method will always be inverted otherwise
655
665
  return true;
@@ -1324,20 +1334,6 @@ public abstract class PlotArea {
1324
1334
  return this.signMaterial;
1325
1335
  }
1326
1336
 
1327
- /**
1328
- * Get the legacy plot sign material before wall signs used a "wall" stance.
1329
- *
1330
- * @return the legacy sign material.
1331
- * @deprecated Use {@link #signMaterial()}. This method is used for 1.13 only and
1332
- * will be removed without replacement in favor of {@link #signMaterial()}
1333
- * once we remove the support for 1.13.
1334
- * @since 6.0.3
1335
- */
1336
- @Deprecated(forRemoval = true, since = "6.0.3")
1337
- public String getLegacySignMaterial() {
1338
- return this.legacySignMaterial;
1339
- }
1340
-
1341
1337
  public boolean isSpawnCustom() {
1342
1338
  return this.spawnCustom;
1343
1339
  }
@@ -1396,22 +1392,6 @@ public abstract class PlotArea {
1396
1392
  return this.defaultHome;
1397
1393
  }
1398
1394
 
1399
- /**
1400
- * @deprecated Use {@link #nonmemberHome}
1401
- */
1402
- @Deprecated(forRemoval = true, since = "6.1.4")
1403
- public PlotLoc getNonmemberHome() {
1404
- return new PlotLoc(this.defaultHome.getX(), this.defaultHome.getY(), this.defaultHome.getZ());
1405
- }
1406
-
1407
- /**
1408
- * @deprecated Use {@link #defaultHome}
1409
- */
1410
- @Deprecated(forRemoval = true, since = "6.1.4")
1411
- public PlotLoc getDefaultHome() {
1412
- return new PlotLoc(this.defaultHome.getX(), this.defaultHome.getY(), this.defaultHome.getZ());
1413
- }
1414
-
1415
1395
  protected void setDefaultHome(BlockLoc defaultHome) {
1416
1396
  this.defaultHome = defaultHome;
1417
1397
  }
Core/src/main/java/com/plotsquared/core/plot/PlotId.java CHANGED
@@ -106,17 +106,6 @@ public final class PlotId {
106
106
  return PlotId.of(hash >> 16, hash & 0xFFFF);
107
107
  }
108
108
 
109
- /**
110
- * Get a copy of the plot ID
111
- *
112
- * @return Plot ID copy
113
- * @deprecated PlotId is immutable, copy is not required.
114
- */
115
- @Deprecated(forRemoval = true, since = "6.10.2")
116
- public @NonNull PlotId copy() {
117
- return this;
118
- }
119
-
120
109
  /**
121
110
  * Get the ID X component
122
111
  *
Core/src/main/java/com/plotsquared/core/plot/PlotManager.java CHANGED
@@ -203,15 +203,6 @@ public abstract class PlotManager {
203
203
  Template.zipAll(plotArea.getWorldName(), files);
204
204
  }
205
205
 
206
- /**
207
- * @return the world height
208
- * @deprecated In favor of custom world heights within 1.17 and therefore scheduled for removal without replacement
209
- */
210
- @Deprecated(forRemoval = true, since = "6.0.0")
211
- public int getWorldHeight() {
212
- return 255;
213
- }
214
-
215
206
  /**
216
207
  * Sets all the blocks along all the plot walls to their correct state (claimed or unclaimed).
217
208
  *
Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java CHANGED
@@ -46,7 +46,9 @@ import com.sk89q.worldedit.math.BlockVector2;
46
46
  import com.sk89q.worldedit.regions.CuboidRegion;
47
47
  import com.sk89q.worldedit.world.biome.BiomeType;
48
48
  import com.sk89q.worldedit.world.block.BlockTypes;
49
- import net.kyori.adventure.text.minimessage.Template;
49
+ import net.kyori.adventure.text.Component;
50
+ import net.kyori.adventure.text.minimessage.tag.Tag;
51
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
50
52
  import org.apache.logging.log4j.LogManager;
51
53
  import org.apache.logging.log4j.Logger;
52
54
  import org.checkerframework.checker.nullness.qual.NonNull;
@@ -415,7 +417,10 @@ public final class PlotModificationManager {
415
417
  Caption[] lines = new Caption[]{TranslatableCaption.of("signs.owner_sign_line_1"), TranslatableCaption.of(
416
418
  "signs.owner_sign_line_2"),
417
419
  TranslatableCaption.of("signs.owner_sign_line_3"), TranslatableCaption.of("signs.owner_sign_line_4")};
418
- PlotSquared.platform().worldUtil().setSign(location, lines, Template.of("id", id), Template.of("owner", name));
420
+ PlotSquared.platform().worldUtil().setSign(location, lines, TagResolver.builder()
421
+ .tag("id", Tag.inserting(Component.text(id)))
422
+ .tag("owner", Tag.inserting(Component.text(name)))
423
+ .build());
419
424
  }
420
425
  }
421
426
 
@@ -524,7 +529,7 @@ public final class PlotModificationManager {
524
529
  if (player != null) {
525
530
  player.sendMessage(
526
531
  TranslatableCaption.of("events.event_denied"),
527
- Template.of("value", "Auto merge on claim")
532
+ TagResolver.resolver("value", Tag.inserting(Component.text("Auto merge on claim")))
528
533
  );
529
534
  }
530
535
  return;
Core/src/main/java/com/plotsquared/core/plot/PlotWorld.java CHANGED
@@ -114,12 +114,4 @@ public abstract class PlotWorld {
114
114
  return world.hashCode();
115
115
  }
116
116
 
117
- /**
118
- * @deprecated This method is not meant to be invoked or overridden, with no replacement.
119
- */
120
- @Deprecated(forRemoval = true, since = "6.6.0")
121
- protected boolean canEqual(final Object other) {
122
- return other instanceof PlotWorld;
123
- }
124
-
125
117
  }
Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java CHANGED
@@ -29,7 +29,9 @@ import com.plotsquared.core.plot.Plot;
29
29
  import com.plotsquared.core.util.task.RunnableVal;
30
30
  import com.plotsquared.core.util.task.TaskManager;
31
31
  import com.plotsquared.core.util.task.TaskTime;
32
- import net.kyori.adventure.text.minimessage.Template;
32
+ import net.kyori.adventure.text.Component;
33
+ import net.kyori.adventure.text.minimessage.tag.Tag;
34
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
33
35
 
34
36
  import java.util.Collection;
35
37
  import java.util.HashMap;
@@ -68,8 +70,10 @@ public class CommentManager {
68
70
  player.sendTitle(
69
71
  StaticCaption.of(""),
70
72
  TranslatableCaption.of("comment.inbox_notification"),
71
- Template.of("amount", Integer.toString(total)),
72
- Template.of("command", "/plot inbox")
73
+ TagResolver.builder()
74
+ .tag("amount", Tag.inserting(Component.text(total)))
75
+ .tag("command", Tag.inserting(Component.text("/plot inbox")))
76
+ .build()
73
77
  );
74
78
  }
75
79
  }
Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java CHANGED
@@ -19,10 +19,8 @@
19
19
  package com.plotsquared.core.plot.expiration;
20
20
 
21
21
  import com.google.inject.Inject;
22
- import com.plotsquared.core.PlotPlatform;
23
22
  import com.plotsquared.core.PlotSquared;
24
23
  import com.plotsquared.core.configuration.caption.Caption;
25
- import com.plotsquared.core.configuration.caption.Templates;
26
24
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
27
25
  import com.plotsquared.core.database.DBFunc;
28
26
  import com.plotsquared.core.events.PlotFlagAddEvent;
@@ -46,7 +44,9 @@ import com.plotsquared.core.util.task.RunnableVal;
46
44
  import com.plotsquared.core.util.task.RunnableVal3;
47
45
  import com.plotsquared.core.util.task.TaskManager;
48
46
  import com.plotsquared.core.util.task.TaskTime;
49
- import net.kyori.adventure.text.minimessage.Template;
47
+ import net.kyori.adventure.text.Component;
48
+ import net.kyori.adventure.text.minimessage.tag.Tag;
49
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
50
50
  import org.checkerframework.checker.nullness.qual.NonNull;
51
51
 
52
52
  import java.util.ArrayDeque;
@@ -62,11 +62,6 @@ import java.util.concurrent.ConcurrentLinkedDeque;
62
62
 
63
63
  public class ExpireManager {
64
64
 
65
- /**
66
- * @deprecated Use {@link PlotPlatform#expireManager()} instead
67
- */
68
- @Deprecated(forRemoval = true, since = "6.10.2")
69
- public static ExpireManager IMP;
70
65
  private final ConcurrentHashMap<UUID, Long> dates_cache;
71
66
  private final ConcurrentHashMap<UUID, Long> account_age_cache;
72
67
  private final EventDispatcher eventDispatcher;
@@ -152,25 +147,17 @@ public class ExpireManager {
152
147
  current.getCenter(pp::teleport);
153
148
  metaDataAccess.remove();
154
149
  Caption msg = TranslatableCaption.of("expiry.expired_options_clicky");
155
- Template numTemplate = Template.of("num", String.valueOf(num));
156
- Template areIsTemplate = Template.of("are_or_is", (num > 1 ? "plots are" : "plot is"));
157
- Template list_cmd = Template.of("list_cmd", "/plot list expired");
158
- Template plot = Template.of("plot", current.toString());
159
- Template cmd_del = Template.of("cmd_del", "/plot delete");
160
- Template cmd_keep_1d = Template.of("cmd_keep_1d", "/plot flag set keep 1d");
161
- Template cmd_keep = Template.of("cmd_keep", "/plot flag set keep true");
162
- Template cmd_no_show_expir = Template.of("cmd_no_show_expir", "/plot toggle clear-confirmation");
163
- pp.sendMessage(
164
- msg,
165
- numTemplate,
166
- areIsTemplate,
167
- list_cmd,
168
- plot,
169
- cmd_del,
170
- cmd_keep_1d,
171
- cmd_keep,
172
- cmd_no_show_expir
173
- );
150
+ TagResolver resolver = TagResolver.builder()
151
+ .tag("num", Tag.inserting(Component.text(num)))
152
+ .tag("are_or_is", Tag.inserting(Component.text(num > 1 ? "plots are" : "plot is")))
153
+ .tag("list_cmd", Tag.preProcessParsed("/plot list expired"))
154
+ .tag("plot", Tag.inserting(Component.text(current.toString())))
155
+ .tag("cmd_del", Tag.preProcessParsed("/plot delete"))
156
+ .tag("cmd_keep_1d", Tag.preProcessParsed("/plot flag set keep 1d"))
157
+ .tag("cmd_keep", Tag.preProcessParsed("/plot flag set keep true"))
158
+ .tag("cmd_no_show_expir", Tag.preProcessParsed("/plot toggle clear-confirmation"))
159
+ .build();
160
+ pp.sendMessage(msg, resolver);
174
161
  return;
175
162
  } else {
176
163
  iter.remove();
@@ -436,7 +423,7 @@ public class ExpireManager {
436
423
  if (player != null) {
437
424
  player.sendMessage(
438
425
  TranslatableCaption.of("trusted.plot_removed_user"),
439
- Templates.of("plot", plot.toString())
426
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
440
427
  );
441
428
  }
442
429
  }
@@ -445,18 +432,13 @@ public class ExpireManager {
445
432
  if (player != null) {
446
433
  player.sendMessage(
447
434
  TranslatableCaption.of("trusted.plot_removed_user"),
448
- Templates.of("plot", plot.toString())
435
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
449
436
  );
450
437
  }
451
438
  }
452
439
  plot.getPlotModificationManager().deletePlot(null, whenDone);
453
440
  }
454
441
 
455
- @Deprecated(forRemoval = true, since = "6.4.0")
456
- public long getAge(UUID uuid) {
457
- return getAge(uuid, false);
458
- }
459
-
460
442
  /**
461
443
  * Get the age (last play time) of the passed player
462
444
  *
Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java CHANGED
@@ -380,14 +380,6 @@ public class FlagContainer {
380
380
  return flagMap.hashCode();
381
381
  }
382
382
 
383
- /**
384
- * @deprecated This method is not meant to be invoked or overridden, with no replacement.
385
- */
386
- @Deprecated(forRemoval = true, since = "6.6.0")
387
- protected boolean canEqual(final Object other) {
388
- return other instanceof FlagContainer;
389
- }
390
-
391
383
  /**
392
384
  * Update event types used in {@link PlotFlagUpdateHandler}.
393
385
  */
Core/src/main/java/com/plotsquared/core/plot/flag/FlagParseException.java CHANGED
@@ -19,14 +19,14 @@
19
19
  package com.plotsquared.core.plot.flag;
20
20
 
21
21
  import com.plotsquared.core.configuration.caption.Caption;
22
- import net.kyori.adventure.text.minimessage.Template;
22
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
23
23
 
24
24
  public class FlagParseException extends Exception {
25
25
 
26
26
  private final PlotFlag<?, ?> flag;
27
27
  private final String value;
28
28
  private final Caption errorMessage;
29
- private final Template[] templates;
29
+ private final TagResolver[] tagResolvers;
30
30
 
31
31
  /**
32
32
  * Construct a new flag parse exception to indicate that an attempt to parse a plot
@@ -39,7 +39,7 @@ public class FlagParseException extends Exception {
39
39
  */
40
40
  public FlagParseException(
41
41
  final PlotFlag<?, ?> flag, final String value,
42
- final Caption errorMessage, final Template... args
42
+ final Caption errorMessage, final TagResolver... args
43
43
  ) {
44
44
  super(String.format("Failed to parse flag of type '%s'. Value '%s' was not accepted.",
45
45
  flag.getName(), value
@@ -47,7 +47,7 @@ public class FlagParseException extends Exception {
47
47
  this.flag = flag;
48
48
  this.value = value;
49
49
  this.errorMessage = errorMessage;
50
- this.templates = args;
50
+ this.tagResolvers = args;
51
51
  }
52
52
 
53
53
  /**
@@ -82,8 +82,8 @@ public class FlagParseException extends Exception {
82
82
  *
83
83
  * @return Message templates.
84
84
  */
85
- public Template[] getTemplates() {
86
- return templates;
85
+ public TagResolver[] getTagResolvers() {
86
+ return tagResolvers;
87
87
  }
88
88
 
89
89
  }
Core/src/main/java/com/plotsquared/core/plot/flag/PlotFlag.java CHANGED
@@ -20,6 +20,7 @@ package com.plotsquared.core.plot.flag;
20
20
 
21
21
  import com.google.common.base.Preconditions;
22
22
  import com.plotsquared.core.configuration.caption.Caption;
23
+ import net.kyori.adventure.text.Component;
23
24
  import org.checkerframework.checker.nullness.qual.NonNull;
24
25
 
25
26
  import java.util.Collection;
@@ -83,6 +84,16 @@ public abstract class PlotFlag<T, F extends PlotFlag<T, F>> {
83
84
  return flagName.toString();
84
85
  }
85
86
 
87
+ /**
88
+ * Gets the flag name as a Kyori {@link Component}
89
+ *
90
+ * @see #getFlagName(Class)
91
+ * @since TODO
92
+ */
93
+ public static <T, F extends PlotFlag<T, F>> Component getFlagNameComponent(Class<F> flagClass) {
94
+ return Component.text(getFlagName(flagClass));
95
+ }
96
+
86
97
  /**
87
98
  * Get the flag value
88
99
  *
@@ -210,13 +221,4 @@ public abstract class PlotFlag<T, F extends PlotFlag<T, F>> {
210
221
  return value.hashCode();
211
222
  }
212
223
 
213
- /**
214
- * @deprecated This method is not meant to be invoked or overridden, with no replacement.
215
- */
216
- @Deprecated(forRemoval = true, since = "6.6.0")
217
- protected boolean canEqual(final Object other) {
218
- return other instanceof PlotFlag;
219
- }
220
-
221
-
222
224
  }
Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java CHANGED
@@ -23,7 +23,9 @@ import com.plotsquared.core.player.PlotPlayer;
23
23
  import com.plotsquared.core.plot.Plot;
24
24
  import com.plotsquared.core.plot.flag.FlagParseException;
25
25
  import com.plotsquared.core.plot.flag.PlotFlag;
26
- import net.kyori.adventure.text.minimessage.Template;
26
+ import net.kyori.adventure.text.Component;
27
+ import net.kyori.adventure.text.minimessage.tag.Tag;
28
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
27
29
  import org.checkerframework.checker.nullness.qual.NonNull;
28
30
  import org.checkerframework.checker.nullness.qual.Nullable;
29
31
 
@@ -82,7 +84,10 @@ public class DenyTeleportFlag extends PlotFlag<DenyTeleportFlag.DeniedGroup, Den
82
84
  final DeniedGroup group = DeniedGroup.fromString(input);
83
85
  if (group == null) {
84
86
  throw new FlagParseException(this, input, TranslatableCaption.of("flags.flag_error_enum"),
85
- Template.of("list", "members, nonmembers, trusted, nontrusted, nonowners")
87
+ TagResolver.resolver(
88
+ "list",
89
+ Tag.inserting(Component.text("members, nonmembers, trusted, nontrusted, nonowners"))
90
+ )
86
91
  );
87
92
  }
88
93
  return flagOf(group);
Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DescriptionFlag.java CHANGED
@@ -51,7 +51,7 @@ public class DescriptionFlag extends StringFlag<DescriptionFlag> {
51
51
 
52
52
  @Override
53
53
  public String getExample() {
54
- return "&6This is my plot!";
54
+ return "<gold>This is my plot!";
55
55
  }
56
56
 
57
57
  @Override
Core/src/main/java/com/plotsquared/core/plot/flag/implementations/FeedFlag.java CHANGED
@@ -21,7 +21,9 @@ package com.plotsquared.core.plot.flag.implementations;
21
21
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
22
22
  import com.plotsquared.core.plot.flag.FlagParseException;
23
23
  import com.plotsquared.core.plot.flag.types.TimedFlag;
24
- import net.kyori.adventure.text.minimessage.Template;
24
+ import net.kyori.adventure.text.Component;
25
+ import net.kyori.adventure.text.minimessage.tag.Tag;
26
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
25
27
  import org.checkerframework.checker.nullness.qual.NonNull;
26
28
 
27
29
  public class FeedFlag extends TimedFlag<Integer, FeedFlag> {
@@ -42,7 +44,7 @@ public class FeedFlag extends TimedFlag<Integer, FeedFlag> {
42
44
  this,
43
45
  input,
44
46
  TranslatableCaption.of("invalid.not_a_number"),
45
- Template.of("value", input)
47
+ TagResolver.resolver("value", Tag.inserting(Component.text(input)))
46
48
  );
47
49
  }
48
50
  if (parsed < 1) {
@@ -50,7 +52,7 @@ public class FeedFlag extends TimedFlag<Integer, FeedFlag> {
50
52
  this,
51
53
  input,
52
54
  TranslatableCaption.of("invalid.number_not_positive"),
53
- Template.of("value", String.valueOf(parsed))
55
+ TagResolver.resolver("value", Tag.inserting(Component.text(parsed)))
54
56
  );
55
57
  }
56
58
  return parsed;
Core/src/main/java/com/plotsquared/core/plot/flag/implementations/GreetingFlag.java CHANGED
@@ -51,7 +51,7 @@ public class GreetingFlag extends StringFlag<GreetingFlag> {
51
51
 
52
52
  @Override
53
53
  public String getExample() {
54
- return "&6Welcome to my plot!";
54
+ return "<gold>Welcome to my plot!";
55
55
  }
56
56
 
57
57
  @Override
Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java CHANGED
@@ -21,7 +21,9 @@ package com.plotsquared.core.plot.flag.implementations;
21
21
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
22
22
  import com.plotsquared.core.plot.flag.FlagParseException;
23
23
  import com.plotsquared.core.plot.flag.types.TimedFlag;
24
- import net.kyori.adventure.text.minimessage.Template;
24
+ import net.kyori.adventure.text.Component;
25
+ import net.kyori.adventure.text.minimessage.tag.Tag;
26
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
25
27
  import org.checkerframework.checker.nullness.qual.NonNull;
26
28
 
27
29
  public class HealFlag extends TimedFlag<Integer, HealFlag> {
@@ -42,7 +44,7 @@ public class HealFlag extends TimedFlag<Integer, HealFlag> {
42
44
  this,
43
45
  input,
44
46
  TranslatableCaption.of("invalid.not_a_number"),
45
- Template.of("value", input)
47
+ TagResolver.resolver("value", Tag.inserting(Component.text(input)))
46
48
  );
47
49
  }
48
50
  if (parsed < 1) {
@@ -50,7 +52,7 @@ public class HealFlag extends TimedFlag<Integer, HealFlag> {
50
52
  this,
51
53
  input,
52
54
  TranslatableCaption.of("invalid.number_not_positive"),
53
- Template.of("value", String.valueOf(parsed))
55
+ TagResolver.resolver("value", Tag.inserting(Component.text(parsed)))
54
56
  );
55
57
  }
56
58
  return parsed;
Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java CHANGED
@@ -21,7 +21,9 @@ package com.plotsquared.core.plot.flag.implementations;
21
21
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
22
22
  import com.plotsquared.core.plot.flag.FlagParseException;
23
23
  import com.plotsquared.core.plot.flag.PlotFlag;
24
- import net.kyori.adventure.text.minimessage.Template;
24
+ import net.kyori.adventure.text.Component;
25
+ import net.kyori.adventure.text.minimessage.tag.Tag;
26
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
25
27
  import org.checkerframework.checker.nullness.qual.NonNull;
26
28
  import org.checkerframework.checker.nullness.qual.Nullable;
27
29
 
@@ -47,7 +49,7 @@ public class TitlesFlag extends PlotFlag<TitlesFlag.TitlesFlagValue, TitlesFlag>
47
49
  this,
48
50
  input,
49
51
  TranslatableCaption.of("flags.flag_error_enum"),
50
- Template.of("list", "none, true, false")
52
+ TagResolver.resolver("list", Tag.inserting(Component.text("none, true, false")))
51
53
  );
52
54
  }
53
55
  return flagOf(titlesFlagValue);
Core/src/main/java/com/plotsquared/core/plot/world/DefaultPlotAreaManager.java CHANGED
@@ -137,15 +137,16 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
137
137
  }
138
138
 
139
139
  @Override
140
- public void addWorld(final @NonNull String worldName) {
140
+ public boolean addWorld(final @NonNull String worldName) {
141
141
  PlotWorld world = this.plotWorlds.get(worldName);
142
142
  if (world != null) {
143
- return;
143
+ return false;
144
144
  }
145
145
  // Create a new empty world. When a new area is added
146
146
  // the world will be re-recreated with the correct type
147
147
  world = new StandardPlotWorld(worldName, null);
148
148
  this.plotWorlds.put(worldName, world);
149
+ return true;
149
150
  }
150
151
 
151
152
  @Override
Core/src/main/java/com/plotsquared/core/plot/world/PlotAreaManager.java CHANGED
@@ -110,8 +110,10 @@ public interface PlotAreaManager {
110
110
  * Add a world
111
111
  *
112
112
  * @param worldName Name of the world to add
113
+ * @return {@code true} if successful, {@code false} if world already existed
114
+ * @since TODO
113
115
  */
114
- void addWorld(@NonNull String worldName);
116
+ boolean addWorld(@NonNull String worldName);
115
117
 
116
118
  /**
117
119
  * Remove a world
Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotAreaManager.java CHANGED
@@ -172,8 +172,8 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
172
172
  }
173
173
 
174
174
  @Override
175
- public void addWorld(final @NonNull String worldName) {
176
- super.addWorld(worldName);
175
+ public boolean addWorld(final @NonNull String worldName) {
176
+ return super.addWorld(worldName);
177
177
  }
178
178
 
179
179
  @Override
Core/src/main/java/com/plotsquared/core/queue/BlockArrayCacheScopedQueueCoordinator.java CHANGED
@@ -18,7 +18,7 @@
18
18
  */
19
19
  package com.plotsquared.core.queue;
20
20
 
21
- import com.intellectualsites.annotations.DoNotUse;
21
+ import com.intellectualsites.annotations.NotPublic;
22
22
  import com.plotsquared.core.location.Location;
23
23
  import com.sk89q.jnbt.CompoundTag;
24
24
  import com.sk89q.worldedit.function.pattern.Pattern;
@@ -36,9 +36,11 @@ import org.checkerframework.checker.nullness.qual.Nullable;
36
36
  * The min and max points of this queue are offset according to the minimum point given in the constructor, and the offsets set
37
37
  * in {@link BlockArrayCacheScopedQueueCoordinator#setOffsetX(int)} and
38
38
  * {@link BlockArrayCacheScopedQueueCoordinator#setOffsetZ(int)}
39
+ *
40
+ * Internal use only. Subject to change at any time and created for specific use cases.
39
41
  */
40
- @DoNotUse
41
- public class BlockArrayCacheScopedQueueCoordinator extends ScopedQueueCoordinator {
42
+ @NotPublic
43
+ public class BlockArrayCacheScopedQueueCoordinator extends ZeroedDelegateScopedQueueCoordinator {
42
44
 
43
45
  private final BlockState[][][] blockStates;
44
46
  private final int height;
Core/src/main/java/com/plotsquared/core/queue/ChunkQueueCoordinator.java DELETED
@@ -1,163 +0,0 @@
1
- /*
2
- * PlotSquared, a land and world management plugin for Minecraft.
3
- * Copyright (C) IntellectualSites <https://intellectualsites.com>
4
- * Copyright (C) IntellectualSites team and contributors
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- */
19
- package com.plotsquared.core.queue;
20
-
21
- import com.plotsquared.core.location.Location;
22
- import com.sk89q.worldedit.function.pattern.Pattern;
23
- import com.sk89q.worldedit.math.BlockVector3;
24
- import com.sk89q.worldedit.world.World;
25
- import com.sk89q.worldedit.world.biome.BiomeType;
26
- import com.sk89q.worldedit.world.block.BaseBlock;
27
- import com.sk89q.worldedit.world.block.BlockState;
28
- import org.checkerframework.checker.nullness.qual.NonNull;
29
- import org.checkerframework.checker.nullness.qual.Nullable;
30
-
31
- /**
32
- * Queue that is limited to a single chunk. It does not allow a delegate queue and should be treated as a cache for changes to
33
- * be set to. Does not support tile entities or entities.
34
- *
35
- * @deprecated This class is poorly designed and will no longer be used in PlotSquared
36
- */
37
- @Deprecated(forRemoval = true, since = "6.8.0")
38
- public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
39
-
40
- public final BiomeType[][][] biomeResult;
41
- public final BlockState[][][] result;
42
- private final int width;
43
- private final int length;
44
- private final BlockVector3 bot;
45
- private final BlockVector3 top;
46
- private final World weWorld;
47
-
48
- public ChunkQueueCoordinator(
49
- final @NonNull World weWorld,
50
- @NonNull BlockVector3 bot,
51
- @NonNull BlockVector3 top,
52
- boolean biomes
53
- ) {
54
- super(null, Location.at("", 0, weWorld.getMinY(), 0), Location.at("", 15, weWorld.getMaxY(), 15));
55
- this.weWorld = weWorld;
56
- this.width = top.getX() - bot.getX() + 1;
57
- this.length = top.getZ() - bot.getZ() + 1;
58
- this.result = new BlockState[weWorld.getMaxY() - weWorld.getMinY() + 1][width][length];
59
- this.biomeResult = biomes ? new BiomeType[weWorld.getMaxY() - weWorld.getMinY() + 1][width][length] : null;
60
- this.bot = bot;
61
- this.top = top;
62
- }
63
-
64
- public @NonNull BlockState[][][] getBlocks() {
65
- return result;
66
- }
67
-
68
- @Override
69
- public boolean setBiome(int x, int z, @NonNull BiomeType biomeType) {
70
- if (this.biomeResult != null) {
71
- for (int y = weWorld.getMinY(); y <= weWorld.getMaxY(); y++) {
72
- this.storeCacheBiome(x, y, z, biomeType);
73
- }
74
- return true;
75
- }
76
- return false;
77
- }
78
-
79
- @Override
80
- public boolean setBiome(int x, int y, int z, @NonNull BiomeType biomeType) {
81
- if (this.biomeResult != null) {
82
- this.storeCacheBiome(x, y, z, biomeType);
83
- return true;
84
- }
85
- return false;
86
- }
87
-
88
- @Override
89
- public boolean setBlock(int x, int y, int z, @NonNull BlockState id) {
90
- this.storeCache(x, y, z, id);
91
- return true;
92
- }
93
-
94
- @Override
95
- public boolean setBlock(int x, int y, int z, @NonNull Pattern pattern) {
96
- this.storeCache(x, y, z, pattern.applyBlock(BlockVector3.at(x, y, z)).toImmutableState());
97
- return true;
98
- }
99
-
100
- private void storeCache(final int x, final int y, final int z, final @NonNull BlockState id) {
101
- int yIndex = getYIndex(y);
102
- BlockState[][] resultY = result[yIndex];
103
- if (resultY == null) {
104
- result[yIndex] = resultY = new BlockState[length][];
105
- }
106
- BlockState[] resultYZ = resultY[z];
107
- if (resultYZ == null) {
108
- resultY[z] = resultYZ = new BlockState[width];
109
- }
110
- resultYZ[x] = id;
111
- }
112
-
113
- private void storeCacheBiome(final int x, final int y, final int z, final @NonNull BiomeType id) {
114
- int yIndex = getYIndex(y);
115
- BiomeType[][] resultY = biomeResult[yIndex];
116
- if (resultY == null) {
117
- biomeResult[yIndex] = resultY = new BiomeType[length][];
118
- }
119
- BiomeType[] resultYZ = resultY[z];
120
- if (resultYZ == null) {
121
- resultY[z] = resultYZ = new BiomeType[width];
122
- }
123
- resultYZ[x] = id;
124
- }
125
-
126
- @Override
127
- public boolean setBlock(int x, int y, int z, final @NonNull BaseBlock id) {
128
- this.storeCache(x, y, z, id.toImmutableState());
129
- return true;
130
- }
131
-
132
- @Override
133
- public @Nullable BlockState getBlock(int x, int y, int z) {
134
- BlockState[][] blocksY = result[getYIndex(y)];
135
- if (blocksY != null) {
136
- BlockState[] blocksYZ = blocksY[z];
137
- if (blocksYZ != null) {
138
- return blocksYZ[x];
139
- }
140
- }
141
- return null;
142
- }
143
-
144
- @Override
145
- public @Nullable World getWorld() {
146
- return weWorld;
147
- }
148
-
149
- @Override
150
- public @NonNull Location getMax() {
151
- return Location.at(getWorld().getName(), top.getX(), top.getY(), top.getZ());
152
- }
153
-
154
- @Override
155
- public @NonNull Location getMin() {
156
- return Location.at(getWorld().getName(), bot.getX(), bot.getY(), bot.getZ());
157
- }
158
-
159
- private int getYIndex(int y) {
160
- return y - weWorld.getMinY();
161
- }
162
-
163
- }
Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java CHANGED
@@ -62,35 +62,17 @@ public abstract class QueueCoordinator {
62
62
  }
63
63
 
64
64
  /**
65
- * Get a {@link ScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
65
+ * Get a {@link ZeroedDelegateScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
66
66
  *
67
67
  * @param x chunk x coordinate
68
68
  * @param z chunk z coordinate
69
- * @return a new {@link ScopedQueueCoordinator}
70
- * @deprecated Use {@link ScopedQueueCoordinator#getForChunk(int, int, int, int)}
69
+ * @return a new {@link ZeroedDelegateScopedQueueCoordinator}
70
+ * @since TODO
71
71
  */
72
- @Deprecated(forRemoval = true, since = "6.6.0")
73
- public ScopedQueueCoordinator getForChunk(int x, int z) {
74
- if (getWorld() == null) {
75
- return getForChunk(x, z, PlotSquared.platform().versionMinHeight(), PlotSquared.platform().versionMaxHeight());
76
- }
77
- return getForChunk(x, z, getWorld().getMinY(), getWorld().getMaxY());
78
- }
79
-
80
- /**
81
- * Get a {@link ScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
82
- *
83
- * @param x chunk x coordinate
84
- * @param z chunk z coordinate
85
- * @return a new {@link ScopedQueueCoordinator}
86
- * @since 6.6.0
87
- * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
88
- */
89
- @Deprecated(forRemoval = true, since = "6.9.0")
90
- public ScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) {
72
+ public ZeroedDelegateScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) {
91
73
  int bx = x << 4;
92
74
  int bz = z << 4;
93
- return new ScopedQueueCoordinator(this, Location.at(getWorld().getName(), bx, minY, bz),
75
+ return new ZeroedDelegateScopedQueueCoordinator(this, Location.at(getWorld().getName(), bx, minY, bz),
94
76
  Location.at(getWorld().getName(), bx + 15, maxY, bz + 15)
95
77
  );
96
78
  }
Core/src/main/java/com/plotsquared/core/queue/{ScopedQueueCoordinator.java → ZeroedDelegateScopedQueueCoordinator.java} RENAMED
@@ -28,13 +28,13 @@ import org.checkerframework.checker.nullness.qual.NonNull;
28
28
  import org.checkerframework.checker.nullness.qual.Nullable;
29
29
 
30
30
  /**
31
- * Queue that only sets blocks with a designated X-Z area, will accept any Y values. Requires all blocks be set normalized in
32
- * the x and z directions, i.e. starting from 0,0. An offset of the minimum point of the region will then be applied to x and z.
31
+ * Queue that only sets blocks with a designated X-Z area, will accept any Y values. Requires all blocks be set normalized to
32
+ * zero in the x and z directions, i.e. starting from 0,0. An offset of the minimum point of the region will then be applied to
33
+ * x and z.
33
34
  *
34
- * @deprecated This should be renamed to NormalizedScopedQueueCoordinator or something.
35
+ * @since TODO
35
36
  */
36
- @Deprecated(forRemoval = true, since = "6.8.0")
37
- public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
37
+ public class ZeroedDelegateScopedQueueCoordinator extends DelegateQueueCoordinator {
38
38
 
39
39
  private final Location min;
40
40
  private final Location max;
@@ -49,8 +49,10 @@ public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
49
49
 
50
50
  /**
51
51
  * Create a new ScopedQueueCoordinator instance that delegates to a given QueueCoordinator. Locations are inclusive.
52
+ *
53
+ * @since TODO
52
54
  */
53
- public ScopedQueueCoordinator(@Nullable QueueCoordinator parent, @NonNull Location min, @NonNull Location max) {
55
+ public ZeroedDelegateScopedQueueCoordinator(@Nullable QueueCoordinator parent, @NonNull Location min, @NonNull Location max) {
54
56
  super(parent);
55
57
  this.min = min;
56
58
  this.max = max;
Core/src/main/java/com/plotsquared/core/queue/subscriber/DefaultProgressSubscriber.java CHANGED
@@ -30,7 +30,9 @@ import com.plotsquared.core.queue.ChunkCoordinator;
30
30
  import com.plotsquared.core.util.task.PlotSquaredTask;
31
31
  import com.plotsquared.core.util.task.TaskManager;
32
32
  import com.plotsquared.core.util.task.TaskTime;
33
- import net.kyori.adventure.text.minimessage.Template;
33
+ import net.kyori.adventure.text.Component;
34
+ import net.kyori.adventure.text.minimessage.tag.Tag;
35
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
34
36
  import org.checkerframework.checker.nullness.qual.NonNull;
35
37
 
36
38
  import javax.annotation.Nullable;
@@ -113,7 +115,10 @@ public class DefaultProgressSubscriber implements ProgressSubscriber {
113
115
  }
114
116
  actor.sendMessage(
115
117
  caption,
116
- Template.of("progress", String.format("%.2f", this.progress.doubleValue() * 100))
118
+ TagResolver.resolver(
119
+ "progress",
120
+ Tag.inserting(Component.text(String.format("%.2f", this.progress.doubleValue() * 100)))
121
+ )
117
122
  );
118
123
  }, interval), wait);
119
124
  }
Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java CHANGED
@@ -32,7 +32,9 @@ import com.plotsquared.core.plot.PlotAreaType;
32
32
  import com.plotsquared.core.plot.PlotId;
33
33
  import com.plotsquared.core.util.SetupUtils;
34
34
  import com.plotsquared.core.util.StringMan;
35
- import net.kyori.adventure.text.minimessage.Template;
35
+ import net.kyori.adventure.text.Component;
36
+ import net.kyori.adventure.text.minimessage.tag.Tag;
37
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
36
38
  import org.checkerframework.checker.nullness.qual.NonNull;
37
39
  import org.checkerframework.checker.nullness.qual.Nullable;
38
40
 
@@ -206,7 +208,10 @@ public enum CommonSetupSteps implements SetupStep {
206
208
  }
207
209
  if (PlotSquared.platform().worldUtil().isWorld(argument)) {
208
210
  if (PlotSquared.get().getPlotAreaManager().hasPlotArea(argument)) {
209
- plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_taken"), Template.of("value", argument));
211
+ plotPlayer.sendMessage(
212
+ TranslatableCaption.of("setup.setup_world_taken"),
213
+ TagResolver.resolver("value", Tag.inserting(Component.text(argument)))
214
+ );
210
215
  return this;
211
216
  }
212
217
  plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_apply_plotsquared"));
Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java CHANGED
@@ -24,7 +24,9 @@ import com.plotsquared.core.configuration.ConfigurationNode;
24
24
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
25
25
  import com.plotsquared.core.player.PlotPlayer;
26
26
  import com.plotsquared.core.util.TabCompletions;
27
- import net.kyori.adventure.text.minimessage.Template;
27
+ import net.kyori.adventure.text.Component;
28
+ import net.kyori.adventure.text.minimessage.tag.Tag;
29
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
28
30
  import org.checkerframework.checker.nullness.qual.NonNull;
29
31
  import org.checkerframework.checker.nullness.qual.Nullable;
30
32
 
@@ -77,10 +79,15 @@ public class SettingsNodeStep implements SetupStep {
77
79
  public void announce(PlotPlayer<?> plotPlayer) {
78
80
  plotPlayer.sendMessage(
79
81
  TranslatableCaption.of("setup.setup_step"),
80
- Template.of("step", String.valueOf(this.getId() + 1)),
81
- Template.of("description", this.configurationNode.getDescription().getComponent(plotPlayer)),
82
- Template.of("type", this.configurationNode.getType().getType()),
83
- Template.of("value", String.valueOf(this.configurationNode.getDefaultValue()))
82
+ TagResolver.builder()
83
+ .tag("step", Tag.inserting(Component.text(this.getId() + 1)))
84
+ .tag(
85
+ "description",
86
+ Tag.inserting(this.configurationNode.getDescription().toComponent(plotPlayer))
87
+ )
88
+ .tag("type", Tag.inserting(Component.text(this.configurationNode.getType().getType())))
89
+ .tag("value", Tag.inserting(Component.text(this.configurationNode.getDefaultValue().toString())))
90
+ .build()
84
91
  );
85
92
  }
86
93
 
Core/src/main/java/com/plotsquared/core/util/ChunkManager.java CHANGED
@@ -21,7 +21,7 @@ package com.plotsquared.core.util;
21
21
  import com.plotsquared.core.PlotSquared;
22
22
  import com.plotsquared.core.location.Location;
23
23
  import com.plotsquared.core.queue.QueueCoordinator;
24
- import com.plotsquared.core.queue.ScopedQueueCoordinator;
24
+ import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
25
25
  import com.plotsquared.core.util.task.RunnableVal;
26
26
  import com.sk89q.worldedit.math.BlockVector2;
27
27
  import com.sk89q.worldedit.world.World;
@@ -32,16 +32,15 @@ import java.util.concurrent.ConcurrentHashMap;
32
32
 
33
33
  public abstract class ChunkManager {
34
34
 
35
- private static final Map<BlockVector2, RunnableVal<ScopedQueueCoordinator>> forceChunks = new ConcurrentHashMap<>();
36
- private static final Map<BlockVector2, RunnableVal<ScopedQueueCoordinator>> addChunks = new ConcurrentHashMap<>();
35
+ private static final Map<BlockVector2, RunnableVal<ZeroedDelegateScopedQueueCoordinator>> forceChunks = new ConcurrentHashMap<>();
36
+ private static final Map<BlockVector2, RunnableVal<ZeroedDelegateScopedQueueCoordinator>> addChunks = new ConcurrentHashMap<>();
37
37
 
38
38
  /**
39
- * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
39
+ * @since TODO
40
40
  */
41
- @Deprecated(forRemoval = true, since = "6.9.0")
42
41
  public static void setChunkInPlotArea(
43
- RunnableVal<ScopedQueueCoordinator> force,
44
- RunnableVal<ScopedQueueCoordinator> add,
42
+ RunnableVal<ZeroedDelegateScopedQueueCoordinator> force,
43
+ RunnableVal<ZeroedDelegateScopedQueueCoordinator> add,
45
44
  String world,
46
45
  BlockVector2 loc
47
46
  ) {
@@ -50,8 +49,8 @@ public abstract class ChunkManager {
50
49
  if (PlotSquared.get().getPlotAreaManager().isAugmented(world) && PlotSquared.get().isNonStandardGeneration(world, loc)) {
51
50
  int blockX = loc.getX() << 4;
52
51
  int blockZ = loc.getZ() << 4;
53
- ScopedQueueCoordinator scoped =
54
- new ScopedQueueCoordinator(
52
+ ZeroedDelegateScopedQueueCoordinator scoped =
53
+ new ZeroedDelegateScopedQueueCoordinator(
55
54
  queue,
56
55
  Location.at(world, blockX, weWorld.getMinY(), blockZ),
57
56
  Location.at(world, blockX + 15, weWorld.getMaxY(), blockZ + 15)
@@ -77,11 +76,10 @@ public abstract class ChunkManager {
77
76
  }
78
77
 
79
78
  /**
80
- * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
79
+ * @since TODO
81
80
  */
82
- @Deprecated(forRemoval = true, since = "6.9.0")
83
- public static boolean preProcessChunk(BlockVector2 loc, ScopedQueueCoordinator queue) {
84
- final RunnableVal<ScopedQueueCoordinator> forceChunk = forceChunks.get(loc);
81
+ public static boolean preProcessChunk(BlockVector2 loc, ZeroedDelegateScopedQueueCoordinator queue) {
82
+ final RunnableVal<ZeroedDelegateScopedQueueCoordinator> forceChunk = forceChunks.get(loc);
85
83
  if (forceChunk != null) {
86
84
  forceChunk.run(queue);
87
85
  forceChunks.remove(loc);
@@ -91,11 +89,10 @@ public abstract class ChunkManager {
91
89
  }
92
90
 
93
91
  /**
94
- * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
92
+ * @since TODO
95
93
  */
96
- @Deprecated(forRemoval = true, since = "6.9.0")
97
- public static boolean postProcessChunk(BlockVector2 loc, ScopedQueueCoordinator queue) {
98
- final RunnableVal<ScopedQueueCoordinator> addChunk = forceChunks.get(loc);
94
+ public static boolean postProcessChunk(BlockVector2 loc, ZeroedDelegateScopedQueueCoordinator queue) {
95
+ final RunnableVal<ZeroedDelegateScopedQueueCoordinator> addChunk = forceChunks.get(loc);
99
96
  if (addChunk != null) {
100
97
  addChunk.run(queue);
101
98
  addChunks.remove(loc);
Core/src/main/java/com/plotsquared/core/util/ComponentHelper.java ADDED
@@ -0,0 +1,65 @@
1
+ /*
2
+ * PlotSquared, a land and world management plugin for Minecraft.
3
+ * Copyright (C) IntellectualSites <https://intellectualsites.com>
4
+ * Copyright (C) IntellectualSites team and contributors
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
+ */
19
+ package com.plotsquared.core.util;
20
+
21
+ import net.kyori.adventure.text.Component;
22
+ import net.kyori.adventure.text.ComponentLike;
23
+ import net.kyori.adventure.text.TextComponent;
24
+
25
+ import java.util.Collection;
26
+
27
+ /**
28
+ * A utility class for modifying components.
29
+ *
30
+ * @since TODO
31
+ */
32
+ public class ComponentHelper {
33
+
34
+ /**
35
+ * Joins multiple {@link Component}s into one final {@link ComponentLike}
36
+ *
37
+ * @param components The components to join
38
+ * @param delimiter The delimiter to use between the components
39
+ * @return The joined components
40
+ * @since TODO
41
+ */
42
+ public static ComponentLike join(Collection<? extends ComponentLike> components, Component delimiter) {
43
+ return join(components.toArray(ComponentLike[]::new), delimiter);
44
+ }
45
+
46
+ /**
47
+ * Joins multiple {@link ComponentLike}s into one final {@link ComponentLike}
48
+ *
49
+ * @param components The components to join
50
+ * @param delimiter The delimiter to use between the components
51
+ * @return The joined components
52
+ * @since TODO
53
+ */
54
+ public static Component join(ComponentLike[] components, Component delimiter) {
55
+ TextComponent.Builder builder = Component.text();
56
+ for (int i = 0, j = components.length; i < j; i++) {
57
+ if (i > 0) {
58
+ builder.append(delimiter);
59
+ }
60
+ builder.append(components[i]);
61
+ }
62
+ return builder.build();
63
+ }
64
+
65
+ }
Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java CHANGED
@@ -74,7 +74,9 @@ import com.sk89q.worldedit.WorldEdit;
74
74
  import com.sk89q.worldedit.function.pattern.Pattern;
75
75
  import com.sk89q.worldedit.world.block.BlockType;
76
76
  import com.sk89q.worldedit.world.block.BlockTypes;
77
- import net.kyori.adventure.text.minimessage.Template;
77
+ import net.kyori.adventure.text.Component;
78
+ import net.kyori.adventure.text.minimessage.tag.Tag;
79
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
78
80
  import org.checkerframework.checker.nullness.qual.NonNull;
79
81
  import org.checkerframework.checker.nullness.qual.Nullable;
80
82
 
@@ -335,8 +337,10 @@ public class EventDispatcher {
335
337
  if (!area.buildRangeContainsY(location.getY()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
336
338
  player.sendMessage(
337
339
  TranslatableCaption.of("height.height_limit"),
338
- Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
339
- Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
340
+ TagResolver.builder()
341
+ .tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
342
+ .tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
343
+ .build()
340
344
  );
341
345
  return false;
342
346
  }
@@ -381,7 +385,7 @@ public class EventDispatcher {
381
385
  if (notifyPerms) {
382
386
  player.sendMessage(
383
387
  TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
384
- Template.of("flag", PlaceFlag.getFlagName(UseFlag.class))
388
+ TagResolver.resolver("flag", Tag.inserting(PlaceFlag.getFlagNameComponent(UseFlag.class)))
385
389
  );
386
390
  }
387
391
  return false;
@@ -448,8 +452,14 @@ public class EventDispatcher {
448
452
  if (notifyPerms) {
449
453
  player.sendMessage(
450
454
  TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
451
- Template.of("flag", PlotFlag.getFlagName(MobPlaceFlag.class)
452
- + '/' + PlotFlag.getFlagName(PlaceFlag.class))
455
+ TagResolver.resolver(
456
+ "flag",
457
+ Tag.inserting(
458
+ PlotFlag.getFlagNameComponent(MobPlaceFlag.class)
459
+ .append(Component.text("/"))
460
+ .append(PlotFlag.getFlagNameComponent(PlaceFlag.class))
461
+ )
462
+ )
453
463
  );
454
464
  }
455
465
  return false;
@@ -484,8 +494,14 @@ public class EventDispatcher {
484
494
  if (notifyPerms) {
485
495
  player.sendMessage(
486
496
  TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
487
- Template.of("flag", PlotFlag.getFlagName(MiscPlaceFlag.class)
488
- + '/' + PlotFlag.getFlagName(PlaceFlag.class))
497
+ TagResolver.resolver(
498
+ "flag",
499
+ Tag.inserting(
500
+ PlotFlag.getFlagNameComponent(MiscPlaceFlag.class)
501
+ .append(Component.text("/"))
502
+ .append(PlotFlag.getFlagNameComponent(PlaceFlag.class))
503
+ )
504
+ )
489
505
  );
490
506
  }
491
507
  return false;
Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java CHANGED
@@ -24,7 +24,9 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
24
24
  import com.plotsquared.core.player.ConsolePlayer;
25
25
  import com.plotsquared.core.plot.BlockBucket;
26
26
  import com.sk89q.worldedit.world.block.BlockState;
27
- import net.kyori.adventure.text.minimessage.Template;
27
+ import net.kyori.adventure.text.Component;
28
+ import net.kyori.adventure.text.minimessage.tag.Tag;
29
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
28
30
  import org.apache.logging.log4j.LogManager;
29
31
  import org.apache.logging.log4j.Logger;
30
32
  import org.checkerframework.checker.nullness.qual.NonNull;
@@ -112,8 +114,10 @@ public final class LegacyConverter {
112
114
  this.setString(section, key, bucket);
113
115
  ConsolePlayer.getConsole().sendMessage(
114
116
  TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
115
- Template.of("value1", block),
116
- Template.of("value2", bucket.toString())
117
+ TagResolver.builder()
118
+ .tag("value1", Tag.inserting(Component.text(block)))
119
+ .tag("value2", Tag.inserting(Component.text(bucket.toString())))
120
+ .build()
117
121
  );
118
122
  }
119
123
 
@@ -128,8 +132,10 @@ public final class LegacyConverter {
128
132
  ConsolePlayer.getConsole()
129
133
  .sendMessage(
130
134
  TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
131
- Template.of("value1", plotBlockArrayString(blocks)),
132
- Template.of("value2", bucket.toString())
135
+ TagResolver.builder()
136
+ .tag("value1", Tag.inserting(Component.text(plotBlockArrayString(blocks))))
137
+ .tag("value2", Tag.inserting(Component.text(bucket.toString())))
138
+ .build()
133
139
  );
134
140
  }
135
141
 
Core/src/main/java/com/plotsquared/core/util/MainUtil.java DELETED
@@ -1,82 +0,0 @@
1
- /*
2
- * PlotSquared, a land and world management plugin for Minecraft.
3
- * Copyright (C) IntellectualSites <https://intellectualsites.com>
4
- * Copyright (C) IntellectualSites team and contributors
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- */
19
- package com.plotsquared.core.util;
20
-
21
- /**
22
- * plot functions
23
- *
24
- * @deprecated Do not use
25
- */
26
- @Deprecated(forRemoval = true, since = "6.0.0")
27
- public class MainUtil {
28
-
29
- /**
30
- * Cache of mapping x,y,z coordinates to the chunk array<br>
31
- * - Used for efficient world generation<br>
32
- */
33
- @Deprecated(forRemoval = true, since = "6.0.0")
34
- public static short[][] x_loc;
35
- @Deprecated(forRemoval = true, since = "6.0.0")
36
- public static short[][] y_loc;
37
- @Deprecated(forRemoval = true, since = "6.0.0")
38
- public static short[][] z_loc;
39
- @Deprecated(forRemoval = true, since = "6.0.0")
40
- public static short[][][] CACHE_I = null;
41
- @Deprecated(forRemoval = true, since = "6.0.0")
42
- public static short[][][] CACHE_J = null;
43
-
44
- /**
45
- * This cache is used for world generation and just saves a bit of calculation time when checking if something is in the plot area.
46
- */
47
- @Deprecated(forRemoval = true, since = "6.0.0")
48
- public static void initCache() {
49
- if (x_loc == null) {
50
- x_loc = new short[16][4096];
51
- y_loc = new short[16][4096];
52
- z_loc = new short[16][4096];
53
- for (int i = 0; i < 16; i++) {
54
- int i4 = i << 4;
55
- for (int j = 0; j < 4096; j++) {
56
- int y = i4 + (j >> 8);
57
- int a = j - ((y & 0xF) << 8);
58
- int z1 = a >> 4;
59
- int x1 = a - (z1 << 4);
60
- x_loc[i][j] = (short) x1;
61
- y_loc[i][j] = (short) y;
62
- z_loc[i][j] = (short) z1;
63
- }
64
- }
65
- }
66
- if (CACHE_I == null) {
67
- CACHE_I = new short[256][16][16];
68
- CACHE_J = new short[256][16][16];
69
- for (int x = 0; x < 16; x++) {
70
- for (int z = 0; z < 16; z++) {
71
- for (int y = 0; y < 256; y++) {
72
- short i = (short) (y >> 4);
73
- short j = (short) ((y & 0xF) << 8 | z << 4 | x);
74
- CACHE_I[y][x][z] = i;
75
- CACHE_J[y][x][z] = j;
76
- }
77
- }
78
- }
79
- }
80
- }
81
-
82
- }
Core/src/main/java/com/plotsquared/core/util/PatternUtil.java CHANGED
@@ -33,7 +33,9 @@ import com.sk89q.worldedit.math.BlockVector3;
33
33
  import com.sk89q.worldedit.world.block.BaseBlock;
34
34
  import com.sk89q.worldedit.world.block.BlockState;
35
35
  import com.sk89q.worldedit.world.block.BlockType;
36
- import net.kyori.adventure.text.minimessage.Template;
36
+ import net.kyori.adventure.text.Component;
37
+ import net.kyori.adventure.text.minimessage.tag.Tag;
38
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
37
39
  import org.checkerframework.checker.nullness.qual.NonNull;
38
40
 
39
41
  import java.util.ArrayList;
@@ -83,7 +85,7 @@ public class PatternUtil {
83
85
  } catch (InputParseException e) {
84
86
  throw new Command.CommandException(
85
87
  TranslatableCaption.of("invalid.not_valid_block"),
86
- Template.of("value", e.getMessage())
88
+ TagResolver.resolver("value", Tag.inserting(Component.text(e.getMessage())))
87
89
  );
88
90
  }
89
91
  }
Core/src/main/java/com/plotsquared/core/util/Permissions.java DELETED
@@ -1,148 +0,0 @@
1
- /*
2
- * PlotSquared, a land and world management plugin for Minecraft.
3
- * Copyright (C) IntellectualSites <https://intellectualsites.com>
4
- * Copyright (C) IntellectualSites team and contributors
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- */
19
- package com.plotsquared.core.util;
20
-
21
- import com.plotsquared.core.configuration.Settings;
22
- import com.plotsquared.core.configuration.caption.TranslatableCaption;
23
- import com.plotsquared.core.permissions.Permission;
24
- import com.plotsquared.core.permissions.PermissionHolder;
25
- import com.plotsquared.core.player.PlotPlayer;
26
- import net.kyori.adventure.text.minimessage.Template;
27
- import org.checkerframework.checker.nullness.qual.NonNull;
28
-
29
- /**
30
- * The Permissions class handles checking user permissions.<br>
31
- * - This will respect * nodes and plots.admin and can be used to check permission ranges (e.g. plots.plot.5)<br>
32
- * - Checking the PlotPlayer class directly will not take the above into account<br>
33
- *
34
- * @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
35
- * classes
36
- */
37
- @Deprecated(forRemoval = true, since = "6.9.3")
38
- public class Permissions {
39
-
40
- /**
41
- * @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
42
- * classes. Use {@link PlotPlayer#hasPermission(String, boolean)}
43
- */
44
- @Deprecated(forRemoval = true, since = "6.9.3")
45
- public static boolean hasPermission(PlotPlayer<?> player, Permission permission, boolean notify) {
46
- return hasPermission(player, permission.toString(), notify);
47
- }
48
-
49
- /**
50
- * Check if the owner of the profile has a given (global) permission
51
- *
52
- * @param caller permission holder
53
- * @param permission Permission
54
- * @return {@code true} if the owner has the given permission, else {@code false}
55
- * @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
56
- * classes. Use {@link PermissionHolder#hasPermission(Permission)}
57
- */
58
- @Deprecated(forRemoval = true, since = "6.9.3")
59
- public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull Permission permission) {
60
- return caller.hasPermission(permission.toString());
61
- }
62
-
63
- /**
64
- * Check if the owner of the profile has a given (global) permission. There is no guarantee that per-world permissions will
65
- * be checked because unmaintained crap plugins like PEX exist.
66
- *
67
- * @param caller permission holder
68
- * @param permission Permission
69
- * @return {@code true} if the owner has the given permission, else {@code false}
70
- * @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
71
- * classes. Use {@link PermissionHolder#hasPermission(String)}
72
- */
73
- @Deprecated(forRemoval = true, since = "6.9.3")
74
- public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull String permission) {
75
- return caller.hasPermission(permission);
76
- }
77
-
78
- /**
79
- * Check if the owner of the profile has a given (global) keyed permission. Checks both {@code permission.key}
80
- * and {@code permission.*}
81
- *
82
- * @param caller permission holder
83
- * @param permission Permission
84
- * @param key Permission "key"
85
- * @return {@code true} if the owner has the given permission, else {@code false}
86
- * @since 6.0.10
87
- * @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
88
- * classes. Use {@link PermissionHolder#hasKeyedPermission(String, String)}
89
- */
90
- @Deprecated(forRemoval = true, since = "6.9.3")
91
- public static boolean hasKeyedPermission(
92
- final @NonNull PermissionHolder caller, final @NonNull String permission,
93
- final @NonNull String key
94
- ) {
95
- return caller.hasKeyedPermission(permission, key);
96
- }
97
-
98
- /**
99
- * Checks if a PlotPlayer has a permission, and optionally send the no permission message if applicable.
100
- *
101
- * @param player permission holder
102
- * @param permission permission
103
- * @param notify if to notify the permission holder
104
- * @return if permission is had
105
- * @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
106
- * classes. Use {@link PlotPlayer#hasPermission(String, boolean)}
107
- */
108
- @Deprecated(forRemoval = true, since = "6.9.3")
109
- public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) {
110
- if (!hasPermission(player, permission)) {
111
- if (notify) {
112
- player.sendMessage(
113
- TranslatableCaption.of("permission.no_permission_event"),
114
- Template.of("node", permission)
115
- );
116
- }
117
- return false;
118
- }
119
- return true;
120
- }
121
-
122
- /**
123
- * @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
124
- * classes. Use {@link PlotPlayer#hasPermissionRange(Permission, int)}
125
- */
126
- @Deprecated(forRemoval = true, since = "6.9.3")
127
- public static int hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range) {
128
- return hasPermissionRange(player, Permission.toString(), range);
129
- }
130
-
131
- /**
132
- * Check the highest permission a PlotPlayer has within a specified range.<br>
133
- * - Excessively high values will lag<br>
134
- * - The default range that is checked is {@link Settings.Limit#MAX_PLOTS}<br>
135
- *
136
- * @param player Player to check for
137
- * @param stub The permission stub to check e.g. for `plots.plot.#` the stub is `plots.plot`
138
- * @param range The range to check
139
- * @return The highest permission they have within that range
140
- * @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
141
- * classes. Use {@link PlotPlayer#hasPermissionRange(String, int)}
142
- */
143
- @Deprecated(forRemoval = true, since = "6.9.3")
144
- public static int hasPermissionRange(PlotPlayer<?> player, String stub, int range) {
145
- return player.hasPermissionRange(stub, range);
146
- }
147
-
148
- }
Core/src/main/java/com/plotsquared/core/util/PlayerManager.java CHANGED
@@ -30,9 +30,11 @@ import com.plotsquared.core.player.OfflinePlotPlayer;
30
30
  import com.plotsquared.core.player.PlotPlayer;
31
31
  import com.plotsquared.core.uuid.UUIDMapping;
32
32
  import net.kyori.adventure.text.Component;
33
+ import net.kyori.adventure.text.ComponentLike;
33
34
  import net.kyori.adventure.text.TextComponent;
34
35
  import net.kyori.adventure.text.minimessage.MiniMessage;
35
- import net.kyori.adventure.text.minimessage.Template;
36
+ import net.kyori.adventure.text.minimessage.tag.Tag;
37
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
36
38
  import org.checkerframework.checker.nullness.qual.NonNull;
37
39
  import org.checkerframework.checker.nullness.qual.Nullable;
38
40
 
@@ -114,18 +116,18 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
114
116
  */
115
117
  public static @NonNull Component getPlayerList(final @NonNull Collection<UUID> uuids, LocaleHolder localeHolder) {
116
118
  if (uuids.isEmpty()) {
117
- return MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(localeHolder));
119
+ return TranslatableCaption.of("info.none").toComponent(localeHolder).asComponent();
118
120
  }
119
121
 
120
122
  final List<UUID> players = new LinkedList<>();
121
- final List<String> users = new LinkedList<>();
123
+ final List<ComponentLike> users = new LinkedList<>();
122
124
  for (final UUID uuid : uuids) {
123
125
  if (uuid == null) {
124
- users.add(MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.none").getComponent(localeHolder)));
126
+ users.add(TranslatableCaption.of("info.none").toComponent(localeHolder));
125
127
  } else if (DBFunc.EVERYONE.equals(uuid)) {
126
- users.add(MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.everyone").getComponent(localeHolder)));
128
+ users.add(TranslatableCaption.of("info.everyone").toComponent(localeHolder));
127
129
  } else if (DBFunc.SERVER.equals(uuid)) {
128
- users.add(MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.console").getComponent(localeHolder)));
130
+ users.add(TranslatableCaption.of("info.console").toComponent(localeHolder));
129
131
  } else {
130
132
  players.add(uuid);
131
133
  }
@@ -134,7 +136,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
134
136
  try {
135
137
  for (final UUIDMapping mapping : PlotSquared.get().getImpromptuUUIDPipeline()
136
138
  .getNames(players).get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS)) {
137
- users.add(mapping.getUsername());
139
+ users.add(Component.text(mapping.getUsername()));
138
140
  }
139
141
  } catch (final Exception e) {
140
142
  e.printStackTrace();
@@ -144,64 +146,20 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
144
146
  TextComponent.Builder list = Component.text();
145
147
  for (int x = 0; x < users.size(); x++) {
146
148
  if (x + 1 == uuids.size()) {
147
- list.append(MINI_MESSAGE.parse(c, Template.of("user", users.get(x))));
149
+ list.append(MINI_MESSAGE.deserialize(c, TagResolver.resolver(
150
+ "user",
151
+ Tag.inserting(users.get(x))
152
+ )));
148
153
  } else {
149
- list.append(MINI_MESSAGE.parse(c + ", ", Template.of("user", users.get(x))));
154
+ list.append(MINI_MESSAGE.deserialize(c + ", ", TagResolver.resolver(
155
+ "user",
156
+ Tag.inserting(users.get(x))
157
+ )));
150
158
  }
151
159
  }
152
160
  return list.asComponent();
153
161
  }
154
162
 
155
- /**
156
- * Get the name from a UUID.
157
- *
158
- * @param owner Owner UUID
159
- * @return The player's name, None, Everyone or Unknown
160
- * @deprecated Use {@link #resolveName(UUID)}
161
- */
162
- @Deprecated(forRemoval = true, since = "6.4.0")
163
- public static @NonNull String getName(final @Nullable UUID owner) {
164
- return getName(owner, true);
165
- }
166
-
167
- /**
168
- * Get the name from a UUID.
169
- *
170
- * @param owner Owner UUID
171
- * @param blocking Whether or not the operation can be blocking
172
- * @return The player's name, None, Everyone or Unknown
173
- * @deprecated Use {@link #resolveName(UUID, boolean)}
174
- */
175
- @Deprecated(forRemoval = true, since = "6.4.0")
176
- public static @NonNull String getName(final @Nullable UUID owner, final boolean blocking) {
177
- if (owner == null) {
178
- TranslatableCaption.of("info.none");
179
- }
180
- if (owner.equals(DBFunc.EVERYONE)) {
181
- TranslatableCaption.of("info.everyone");
182
- }
183
- if (owner.equals(DBFunc.SERVER)) {
184
- TranslatableCaption.of("info.server");
185
- }
186
- final String name;
187
- if (blocking) {
188
- name = PlotSquared.get().getImpromptuUUIDPipeline()
189
- .getSingle(owner, Settings.UUID.BLOCKING_TIMEOUT);
190
- } else {
191
- final UUIDMapping uuidMapping =
192
- PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(owner);
193
- if (uuidMapping != null) {
194
- name = uuidMapping.getUsername();
195
- } else {
196
- name = null;
197
- }
198
- }
199
- if (name == null) {
200
- TranslatableCaption.of("info.unknown");
201
- }
202
- return name;
203
- }
204
-
205
163
  /**
206
164
  * Attempts to resolve the username by an uuid
207
165
  * <p>
Core/src/main/java/com/plotsquared/core/util/RegExUtil.java DELETED
@@ -1,34 +0,0 @@
1
- /*
2
- * PlotSquared, a land and world management plugin for Minecraft.
3
- * Copyright (C) IntellectualSites <https://intellectualsites.com>
4
- * Copyright (C) IntellectualSites team and contributors
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- */
19
- package com.plotsquared.core.util;
20
-
21
- import java.util.HashMap;
22
- import java.util.Map;
23
- import java.util.regex.Pattern;
24
-
25
- @Deprecated(since = "6.6.2", forRemoval = true)
26
- public class RegExUtil {
27
-
28
- public static Map<String, Pattern> compiledPatterns;
29
-
30
- static {
31
- compiledPatterns = new HashMap<>();
32
- }
33
-
34
- }
Core/src/main/java/com/plotsquared/core/util/RegionManager.java CHANGED
@@ -372,17 +372,6 @@ public abstract class RegionManager {
372
372
  });
373
373
  }
374
374
 
375
- @Deprecated(forRemoval = true, since = "6.6.0")
376
- public void setBiome(
377
- final CuboidRegion region,
378
- final int extendBiome,
379
- final BiomeType biome,
380
- final String world,
381
- final Runnable whenDone
382
- ) {
383
- setBiome(region, extendBiome, biome, PlotSquared.get().getPlotAreaManager().getPlotAreas(world, region)[0], whenDone);
384
- }
385
-
386
375
  /**
387
376
  * Set a region to a biome type.
388
377
  *
Core/src/main/java/com/plotsquared/core/util/RegionUtil.java CHANGED
@@ -68,11 +68,6 @@ public class RegionUtil {
68
68
  return new CuboidRegion(min, max);
69
69
  }
70
70
 
71
- @Deprecated(forRemoval = true, since = "6.6.0")
72
- public static CuboidRegion createRegion(int pos1x, int pos2x, int pos1z, int pos2z) {
73
- return createRegion(pos1x, pos2x, 0, 255, pos1z, pos2z);
74
- }
75
-
76
71
  public static CuboidRegion createRegion(
77
72
  int pos1x, int pos2x, int pos1y, int pos2y, int pos1z,
78
73
  int pos2z
Core/src/main/java/com/plotsquared/core/util/TabCompletions.java CHANGED
@@ -25,7 +25,6 @@ import com.plotsquared.core.command.Command;
25
25
  import com.plotsquared.core.command.CommandCategory;
26
26
  import com.plotsquared.core.command.RequiredType;
27
27
  import com.plotsquared.core.configuration.Settings;
28
- import com.plotsquared.core.player.ConsolePlayer;
29
28
  import com.plotsquared.core.player.PlotPlayer;
30
29
  import com.plotsquared.core.plot.Plot;
31
30
  import com.plotsquared.core.plot.PlotArea;
@@ -67,23 +66,6 @@ public final class TabCompletions {
67
66
  "This is a utility class and cannot be instantiated");
68
67
  }
69
68
 
70
- /**
71
- * Get a list of tab completions corresponding to player names. This uses the UUID pipeline
72
- * cache, so it will complete will all names known to PlotSquared
73
- *
74
- * @param input Command input
75
- * @param existing Players that should not be included in completions
76
- * @return List of completions
77
- * @deprecated In favor {@link #completePlayers(PlotPlayer, String, List)}
78
- */
79
- @Deprecated(forRemoval = true, since = "6.1.3")
80
- public static @NonNull List<Command> completePlayers(
81
- final @NonNull String input,
82
- final @NonNull List<String> existing
83
- ) {
84
- return completePlayers(ConsolePlayer.getConsole(), input, existing);
85
- }
86
-
87
69
  /**
88
70
  * Get a list of tab completions corresponding to player names. This uses the UUID pipeline
89
71
  * cache, so it will complete will all names known to PlotSquared
@@ -102,24 +84,6 @@ public final class TabCompletions {
102
84
  return completePlayers("players", issuer, input, existing, uuid -> true);
103
85
  }
104
86
 
105
- /**
106
- * Get a list of tab completions corresponding to player names added to the given plot.
107
- *
108
- * @param plot Plot to complete added players for
109
- * @param input Command input
110
- * @param existing Players that should not be included in completions
111
- * @return List of completions
112
- *
113
- * @deprecated In favor {@link #completeAddedPlayers(PlotPlayer, Plot, String, List)}
114
- */
115
- @Deprecated(forRemoval = true, since = "6.1.3")
116
- public static @NonNull List<Command> completeAddedPlayers(
117
- final @NonNull Plot plot,
118
- final @NonNull String input, final @NonNull List<String> existing
119
- ) {
120
- return completeAddedPlayers(ConsolePlayer.getConsole(), plot, input, existing);
121
- }
122
-
123
87
  /**
124
88
  * Get a list of tab completions corresponding to player names added to the given plot.
125
89
  *
@@ -251,24 +215,6 @@ public final class TabCompletions {
251
215
  return Collections.unmodifiableList(completions);
252
216
  }
253
217
 
254
- /**
255
- * @param cacheIdentifier Cache key
256
- * @param input Command input
257
- * @param existing Players that should not be included in completions
258
- * @param uuidFilter Filter applied before caching values
259
- * @return List of completions
260
- * @deprecated In favor {@link #completePlayers(String, PlotPlayer, String, List, Predicate)}
261
- */
262
- @SuppressWarnings("unused")
263
- @Deprecated(forRemoval = true, since = "6.1.3")
264
- private static List<Command> completePlayers(
265
- final @NonNull String cacheIdentifier,
266
- final @NonNull String input, final @NonNull List<String> existing,
267
- final @NonNull Predicate<UUID> uuidFilter
268
- ) {
269
- return completePlayers(cacheIdentifier, ConsolePlayer.getConsole(), input, existing, uuidFilter);
270
- }
271
-
272
218
  /**
273
219
  * @param cacheIdentifier Cache key
274
220
  * @param issuer The player who issued the tab completion
Core/src/main/java/com/plotsquared/core/util/WorldUtil.java CHANGED
@@ -30,14 +30,13 @@ import com.sk89q.jnbt.NBTInputStream;
30
30
  import com.sk89q.jnbt.NBTOutputStream;
31
31
  import com.sk89q.jnbt.Tag;
32
32
  import com.sk89q.worldedit.math.BlockVector2;
33
- import com.sk89q.worldedit.math.BlockVector3;
34
33
  import com.sk89q.worldedit.regions.CuboidRegion;
35
34
  import com.sk89q.worldedit.world.World;
36
35
  import com.sk89q.worldedit.world.biome.BiomeType;
37
36
  import com.sk89q.worldedit.world.block.BlockState;
38
37
  import com.sk89q.worldedit.world.block.BlockType;
39
38
  import com.sk89q.worldedit.world.entity.EntityType;
40
- import net.kyori.adventure.text.minimessage.Template;
39
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
41
40
  import org.checkerframework.checker.index.qual.NonNegative;
42
41
  import org.checkerframework.checker.nullness.qual.NonNull;
43
42
  import org.checkerframework.checker.nullness.qual.Nullable;
@@ -63,26 +62,6 @@ import java.util.zip.ZipOutputStream;
63
62
 
64
63
  public abstract class WorldUtil {
65
64
 
66
- /**
67
- * Set the biome in a region
68
- *
69
- * @param world World name
70
- * @param p1x Min X
71
- * @param p1z Min Z
72
- * @param p2x Max X
73
- * @param p2z Max Z
74
- * @param biome Biome
75
- * @deprecated use {@link WorldUtil#setBiome(String, CuboidRegion, BiomeType)}
76
- */
77
- @Deprecated(forRemoval = true)
78
- public static void setBiome(String world, int p1x, int p1z, int p2x, int p2z, BiomeType biome) {
79
- World weWorld = PlotSquared.platform().worldUtil().getWeWorld(world);
80
- BlockVector3 pos1 = BlockVector2.at(p1x, p1z).toBlockVector3(weWorld.getMinY());
81
- BlockVector3 pos2 = BlockVector2.at(p2x, p2z).toBlockVector3(weWorld.getMaxY());
82
- CuboidRegion region = new CuboidRegion(pos1, pos2);
83
- PlotSquared.platform().worldUtil().setBiomes(world, region, biome);
84
- }
85
-
86
65
  /**
87
66
  * Set the biome in a region
88
67
  *
@@ -155,7 +134,7 @@ public abstract class WorldUtil {
155
134
  public abstract void setSign(
156
135
  @NonNull Location location,
157
136
  @NonNull Caption[] lines,
158
- @NonNull Template... replacements
137
+ @NonNull TagResolver... replacements
159
138
  );
160
139
 
161
140
  /**
Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpObject.java CHANGED
@@ -20,33 +20,35 @@ package com.plotsquared.core.util.helpmenu;
20
20
 
21
21
  import com.plotsquared.core.command.Argument;
22
22
  import com.plotsquared.core.command.Command;
23
- import com.plotsquared.core.configuration.caption.Templates;
24
23
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
25
24
  import com.plotsquared.core.player.PlotPlayer;
26
25
  import com.plotsquared.core.util.StringMan;
26
+ import net.kyori.adventure.text.Component;
27
+ import net.kyori.adventure.text.ComponentLike;
27
28
  import net.kyori.adventure.text.minimessage.MiniMessage;
28
- import net.kyori.adventure.text.minimessage.Template;
29
+ import net.kyori.adventure.text.minimessage.tag.Tag;
30
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
31
+ import org.jetbrains.annotations.NotNull;
29
32
 
30
- public class HelpObject {
33
+ public class HelpObject implements ComponentLike {
31
34
 
32
- static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
35
+ static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
33
36
 
34
- private final String rendered;
37
+ private final Component rendered;
35
38
 
36
39
  public HelpObject(final Command command, final String label, final PlotPlayer<?> audience) {
37
- rendered = MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
40
+ rendered = MINI_MESSAGE.deserialize(
38
41
  TranslatableCaption.of("help.help_item").getComponent(audience),
39
- Template.of("usage", command.getUsage().replace("{label}", label)),
40
- Template.of("alias", command.getAliases().isEmpty() ? "" : StringMan.join(command.getAliases(), " | ")),
41
- Templates.of(audience, "desc", command.getDescription()),
42
- Template.of("arguments", buildArgumentList(command.getRequiredArguments())),
43
- Template.of("label", label)
44
- ));
45
- }
46
-
47
- @Override
48
- public String toString() {
49
- return rendered;
42
+ TagResolver.builder()
43
+ .tag("usage", Tag.inserting(Component.text(command.getUsage().replace("{label}", label))))
44
+ .tag("alias", Tag.inserting(Component.text(
45
+ command.getAliases().isEmpty() ? "" : StringMan.join(command.getAliases(), " | ")
46
+ )))
47
+ .tag("desc", Tag.inserting(command.getDescription().toComponent(audience)))
48
+ .tag("arguments", Tag.inserting(Component.text(buildArgumentList(command.getRequiredArguments()))))
49
+ .tag("label", Tag.inserting(Component.text(label)))
50
+ .build()
51
+ );
50
52
  }
51
53
 
52
54
  private String buildArgumentList(final Argument<?>[] arguments) {
@@ -61,4 +63,9 @@ public class HelpObject {
61
63
  return arguments.length > 0 ? builder.substring(0, builder.length() - 1) : "";
62
64
  }
63
65
 
66
+ @Override
67
+ public @NotNull Component asComponent() {
68
+ return this.rendered;
69
+ }
70
+
64
71
  }
Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpPage.java CHANGED
@@ -22,50 +22,46 @@ import com.plotsquared.core.command.CommandCategory;
22
22
  import com.plotsquared.core.configuration.caption.StaticCaption;
23
23
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
24
24
  import com.plotsquared.core.player.PlotPlayer;
25
- import com.plotsquared.core.util.StringMan;
25
+ import com.plotsquared.core.util.ComponentHelper;
26
+ import net.kyori.adventure.text.Component;
26
27
  import net.kyori.adventure.text.minimessage.MiniMessage;
27
- import net.kyori.adventure.text.minimessage.Template;
28
+ import net.kyori.adventure.text.minimessage.tag.Tag;
29
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
28
30
 
29
31
  import java.util.ArrayList;
30
32
  import java.util.List;
31
33
 
32
34
  public class HelpPage {
33
35
 
34
- private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
36
+ private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
35
37
  private final List<HelpObject> helpObjects;
36
- private final Template catTemplate;
37
- private final Template curTemplate;
38
- private final Template maxTemplate;
38
+ private final TagResolver pageHeaderResolver;
39
39
 
40
40
  public HelpPage(CommandCategory category, int currentPage, int maxPages) {
41
41
  this.helpObjects = new ArrayList<>();
42
- this.catTemplate = Template.of("category", category == null ? "ALL" : category.name());
43
- this.curTemplate = Template.of("current", String.valueOf(currentPage + 1));
44
- this.maxTemplate = Template.of("max", String.valueOf(maxPages + 1));
42
+ this.pageHeaderResolver = TagResolver.builder()
43
+ .tag("category", Tag.inserting(Component.text(category == null ? "ALL" : category.name())))
44
+ .tag("current", Tag.inserting(Component.text(currentPage + 1)))
45
+ .tag("max", Tag.inserting(Component.text(maxPages + 1)))
46
+ .build();
45
47
  }
46
48
 
47
49
  public void render(PlotPlayer<?> player) {
48
50
  if (this.helpObjects.size() < 1) {
49
51
  player.sendMessage(TranslatableCaption.of("help.no_permission"));
50
52
  } else {
51
- Template header = Template.of("header", TranslatableCaption.of("help.help_header").getComponent(player));
52
- Template page_header = Template.of(
53
- "page_header",
54
- MINI_MESSAGE.parse(
53
+ TagResolver contentResolver = TagResolver.builder()
54
+ .tag("header", Tag.inserting(TranslatableCaption.of("help.help_header").toComponent(player)))
55
+ .tag("page_header", Tag.inserting(MINI_MESSAGE.deserialize(
55
56
  TranslatableCaption.of("help.help_page_header").getComponent(player),
56
- catTemplate,
57
- curTemplate,
58
- maxTemplate
59
- )
60
- );
61
- Template help_objects = Template.of("help_objects", StringMan.join(this.helpObjects, "\n"));
62
- Template footer = Template.of("footer", TranslatableCaption.of("help.help_footer").getComponent(player));
57
+ pageHeaderResolver
58
+ )))
59
+ .tag("help_objects", Tag.inserting(ComponentHelper.join(this.helpObjects, Component.text("\n"))))
60
+ .tag("footer", Tag.inserting(TranslatableCaption.of("help.help_footer").toComponent(player)))
61
+ .build();
63
62
  player.sendMessage(
64
63
  StaticCaption.of("<header>\n<page_header>\n<help_objects>\n<footer>"),
65
- header,
66
- page_header,
67
- help_objects,
68
- footer
64
+ contentResolver
69
65
  );
70
66
  }
71
67
  }
Core/src/main/java/com/plotsquared/core/util/placeholders/PlaceholderRegistry.java CHANGED
@@ -35,7 +35,6 @@ import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
35
35
  import com.plotsquared.core.util.EventDispatcher;
36
36
  import com.plotsquared.core.util.PlayerManager;
37
37
  import net.kyori.adventure.text.Component;
38
- import net.kyori.adventure.text.minimessage.MiniMessage;
39
38
  import org.checkerframework.checker.nullness.qual.NonNull;
40
39
  import org.checkerframework.checker.nullness.qual.Nullable;
41
40
 
@@ -74,8 +73,7 @@ public final class PlaceholderRegistry {
74
73
  * @return a legacy-formatted string.
75
74
  */
76
75
  private static String legacyComponent(TranslatableCaption caption, LocaleHolder localeHolder) {
77
- Component component = MiniMessage.get().parse(caption.getComponent(localeHolder));
78
- return PlotSquared.platform().toLegacyPlatformString(component);
76
+ return PlotSquared.platform().toLegacyPlatformString(caption.toComponent(localeHolder).asComponent());
79
77
  }
80
78
 
81
79
  private void registerDefault() {
Core/src/main/java/com/plotsquared/core/util/task/AutoClaimFinishTask.java CHANGED
@@ -18,7 +18,6 @@
18
18
  */
19
19
  package com.plotsquared.core.util.task;
20
20
 
21
- import com.plotsquared.core.configuration.caption.Templates;
22
21
  import com.plotsquared.core.configuration.caption.TranslatableCaption;
23
22
  import com.plotsquared.core.events.PlotMergeEvent;
24
23
  import com.plotsquared.core.events.Result;
@@ -29,6 +28,9 @@ import com.plotsquared.core.player.PlotPlayer;
29
28
  import com.plotsquared.core.plot.Plot;
30
29
  import com.plotsquared.core.plot.PlotArea;
31
30
  import com.plotsquared.core.util.EventDispatcher;
31
+ import net.kyori.adventure.text.Component;
32
+ import net.kyori.adventure.text.minimessage.tag.Tag;
33
+ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
32
34
 
33
35
  import java.util.concurrent.Callable;
34
36
 
@@ -68,7 +70,7 @@ public final class AutoClaimFinishTask implements Callable<Boolean> {
68
70
  if (event.getEventResult() == Result.DENY) {
69
71
  player.sendMessage(
70
72
  TranslatableCaption.of("events.event_denied"),
71
- Templates.of("value", "Auto Merge")
73
+ TagResolver.resolver("value", Tag.inserting(Component.text("Auto Merge")))
72
74
  );
73
75
  } else {
74
76
  if (plot.getPlotModificationManager().autoMerge(event.getDir(), event.getMax(), player.getUUID(), player, true)) {
Core/src/main/java/com/plotsquared/core/uuid/UUIDMapping.java CHANGED
@@ -61,12 +61,4 @@ public class UUIDMapping {
61
61
  return Objects.hash(uuid, username);
62
62
  }
63
63
 
64
- /**
65
- * @deprecated This method is not meant to be invoked or overridden, with no replacement.
66
- */
67
- @Deprecated(forRemoval = true, since = "6.6.0")
68
- protected boolean canEqual(final Object other) {
69
- return other instanceof UUIDMapping;
70
- }
71
-
72
64
  }
Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java CHANGED
@@ -41,13 +41,10 @@ import java.util.UUID;
41
41
  import java.util.concurrent.CompletableFuture;
42
42
  import java.util.concurrent.ExecutionException;
43
43
  import java.util.concurrent.Executor;
44
- import java.util.concurrent.Executors;
45
- import java.util.concurrent.ScheduledExecutorService;
46
44
  import java.util.concurrent.TimeUnit;
47
45
  import java.util.concurrent.TimeoutException;
48
46
  import java.util.function.BiConsumer;
49
47
  import java.util.function.Consumer;
50
- import java.util.function.Function;
51
48
 
52
49
  /**
53
50
  * An UUID pipeline is essentially an ordered list of
@@ -65,7 +62,6 @@ public class UUIDPipeline {
65
62
  private final Executor executor;
66
63
  private final List<UUIDService> serviceList;
67
64
  private final List<Consumer<List<UUIDMapping>>> consumerList;
68
- private final ScheduledExecutorService timeoutExecutor;
69
65
 
70
66
  /**
71
67
  * Construct a new UUID pipeline
@@ -77,7 +73,6 @@ public class UUIDPipeline {
77
73
  this.executor = executor;
78
74
  this.serviceList = Lists.newLinkedList();
79
75
  this.consumerList = Lists.newLinkedList();
80
- this.timeoutExecutor = Executors.newSingleThreadScheduledExecutor();
81
76
  }
82
77
 
83
78
  /**
@@ -207,10 +202,8 @@ public class UUIDPipeline {
207
202
  * @param uuid UUID consumer
208
203
  */
209
204
  public void getSingle(final @NonNull String username, final @NonNull BiConsumer<@Nullable UUID, @Nullable Throwable> uuid) {
210
- this.getUUIDs(Collections.singletonList(username)).applyToEither(
211
- timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT),
212
- Function.identity()
213
- )
205
+ this.getUUIDs(Collections.singletonList(username))
206
+ .orTimeout(Settings.UUID.NON_BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS)
214
207
  .whenComplete((uuids, throwable) -> {
215
208
  if (throwable != null) {
216
209
  uuid.accept(null, throwable);
@@ -231,10 +224,8 @@ public class UUIDPipeline {
231
224
  * @param username Username consumer
232
225
  */
233
226
  public void getSingle(final @NonNull UUID uuid, final @NonNull BiConsumer<@Nullable String, @Nullable Throwable> username) {
234
- this.getNames(Collections.singletonList(uuid)).applyToEither(
235
- timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT),
236
- Function.identity()
237
- )
227
+ this.getNames(Collections.singletonList(uuid))
228
+ .orTimeout(Settings.UUID.NON_BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS)
238
229
  .whenComplete((uuids, throwable) -> {
239
230
  if (throwable != null) {
240
231
  username.accept(null, throwable);
@@ -262,7 +253,7 @@ public class UUIDPipeline {
262
253
  final @NonNull Collection<@NonNull UUID> requests,
263
254
  final long timeout
264
255
  ) {
265
- return this.getNames(requests).applyToEither(timeoutAfter(timeout), Function.identity());
256
+ return this.getNames(requests).orTimeout(timeout, TimeUnit.MILLISECONDS);
266
257
  }
267
258
 
268
259
  /**
@@ -279,13 +270,7 @@ public class UUIDPipeline {
279
270
  final @NonNull Collection<String> requests,
280
271
  final long timeout
281
272
  ) {
282
- return this.getUUIDs(requests).applyToEither(timeoutAfter(timeout), Function.identity());
283
- }
284
-
285
- private @NonNull CompletableFuture<@NonNull List<@NonNull UUIDMapping>> timeoutAfter(final long timeout) {
286
- final CompletableFuture<List<UUIDMapping>> result = new CompletableFuture<>();
287
- this.timeoutExecutor.schedule(() -> result.completeExceptionally(new TimeoutException()), timeout, TimeUnit.MILLISECONDS);
288
- return result;
273
+ return this.getUUIDs(requests).orTimeout(timeout, TimeUnit.MILLISECONDS);
289
274
  }
290
275
 
291
276
  /**
@@ -345,7 +330,7 @@ public class UUIDPipeline {
345
330
  for (final UUID uuid : remainingRequests) {
346
331
  mappings.add(new UUIDMapping(
347
332
  uuid,
348
- MINI_MESSAGE.stripTokens(TranslatableCaption
333
+ MINI_MESSAGE.escapeTags(TranslatableCaption
349
334
  .of("info.unknown")
350
335
  .getComponent(ConsolePlayer.getConsole()))
351
336
  ));
Core/src/main/resources/lang/messages_en.json CHANGED
@@ -21,8 +21,8 @@
21
21
  "web.generating_link": "<prefix><dark_aqua>Processing plot </dark_aqua><gold><plot></gold>",
22
22
  "web.plot_merged": "<prefix><red>This plot is merged and therefore cannot be downloaded</red>",
23
23
  "web.generating_link_failed": "<prefix><red>Failed to generate download link for plot <plot>!</red>",
24
- "web.generation_link_success": "<prefix><gold>Download: <gray><click:open_url:<download>><download></click></gray> \n Deletion: <gray><click:open_url:<delete>><delete></click></gray>\n<red>Attention: Opening the deletion link will delete the file immediately.</red></gold>",
25
- "web.generation_link_success_legacy_world": "<prefix><gold>Download: <gray><click:open_url:<url>><url></click></gray></gold>",
24
+ "web.generation_link_success": "<prefix><gold>Download: <gray><click:open_url:'<download>'><download></click></gray> \n Deletion: <gray><click:open_url:'<delete>'><delete></click></gray>\n<red>Attention: Opening the deletion link will delete the file immediately.</red></gold>",
25
+ "web.generation_link_success_legacy_world": "<prefix><gold>Download: <gray><click:open_url:'<url>'><url></click></gray></gold>",
26
26
  "web.save_failed": "<prefix><red>Failed to save.</red>",
27
27
  "web.load_null": "<prefix><gray>Please use </gray><dark_aqua><command> </dark_aqua><gray>to get a list of schematics.</gray>",
28
28
  "web.load_failed": "<prefix><red>Failed to load schematic.</red>",
@@ -59,7 +59,7 @@
59
59
  "worldedit.worldedit_bypass": "<prefix><gray><italic>To bypass your restrictions use </gray><dark_aqua><command></dark_aqua></italic>",
60
60
  "worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>",
61
61
  "gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray><gamemode></gray><gold>) <gold>set for </gold><gray><plot>.</gray>",
62
- "height.height_limit": "<prefix><gold>This plot area has building height limits: Min height: </gold><gray><minHeight></gray><gold>, Max height: </gold><gray><maxHeight></gray>",
62
+ "height.height_limit": "<prefix><gold>This plot area has building height limits: Min height: </gold><gray><minheight></gray><gold>, Max height: </gold><gray><maxheight></gray>",
63
63
  "notification.notify_enter": "<prefix><gray><player> entered your plot (</gray><gold><area>;<plot></gold><gray>).</gray>",
64
64
  "notification.notify_leave": "<prefix><gray><player> left your plot (</gray><gold><area>;<plot></gold><gray>).</gray>",
65
65
  "swap.swap_overlap": "<prefix><red>The proposed areas are not allowed to overlap.</red>",
@@ -281,7 +281,7 @@
281
281
  "debugexec.expiry_already_started": "<prefix><gold>Plot expiry task already started.</gold>",
282
282
  "debugexec.script_list_item": "<dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray><gold> <name></gold>",
283
283
  "debugexec.analyze_done": "<prefix><gold>Done. Use </gold><gray><command></gray><gold> for more information. ",
284
- "expiry.expired_options_clicky": "<gold><num> <are_or_is> expired: </gold><click:run_command:<list_cmd>><hover:show_text:\"<list_cmd>\"><gray><plot></gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_del>><hover:show_text:\"<cmd_del>\"><gray>Delete this (<cmd_del>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_keep_1d>><hover:show_text:\"<cmd_keep_1d>\"><gray>Remind later (<cmd_keep_1d>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_keep>><hover:show_text:\"<cmd_keep>\"><gray>Keep this (<cmd_keep>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_no_show_expir>><hover:show_text:\"<cmd_no_show_expir>\"><gray>Don't show me this (<cmd_no_show_expir>)</gray></hover></click>",
284
+ "expiry.expired_options_clicky": "<gold><num> <are_or_is> expired: </gold><click:run_command:'<list_cmd>'><hover:show_text:'<list_cmd>'><gray><plot></gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:'<cmd_del>'><hover:show_text:'<cmd_del>'><gray>Delete this (<cmd_del>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:'<cmd_keep_1d>'><hover:show_text:'<cmd_keep_1d>'><gray>Remind later (<cmd_keep_1d>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:'<cmd_keep>'><hover:show_text:'<cmd_keep>'><gray>Keep this (<cmd_keep>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:'<cmd_no_show_expir>'><hover:show_text:'<cmd_no_show_expir>'><gray>Don't show me this (<cmd_no_show_expir>)</gray></hover></click>",
285
285
  "debugimportworlds.single_plot_area": "<prefix><red>Must be a single plot area.</red>",
286
286
  "debugimportworlds.world_container": "<prefix><red>World container must be configured to be a separate directory to your base files.</red>",
287
287
  "debugroadregen.regen_done": "<prefix><gold>Regenerating plot south/east roads: </gold><gray><value></gray>\n<dark_gray> - </dark_gray><gold>Result: </gold><green>Success!</green>",
@@ -373,20 +373,20 @@
373
373
  "info.plot_no_description": "<gray>No description set.</gray>",
374
374
  "info.plot_caps_header": "<dark_gray><strikethrough>--------- <reset><gold>CAPS </gold><dark_gray><strikethrough>---------<reset>",
375
375
  "info.plot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>",
376
- "info.plot_list_item": "<click:run_command:<command_tp>><hover:show_text:\"<command_tp>\"><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click><click:run_command:<command_info>> <hover:show_text:\"<hover_info>\"><gold> <plot></gold></hover></click><gray> - </gray><players>",
376
+ "info.plot_list_item": "<click:run_command:'<command_tp>'><hover:show_text:'<command_tp>'><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click><click:run_command:'<command_info>'> <hover:show_text:'<hover_info>'><gold> <plot></gold></hover></click><gray> - </gray><players>",
377
377
  "info.plot_list_no_owner": "<dark_gray><plot></dark_gray>",
378
378
  "info.plot_list_owned_by": "<gold><plot></gold>",
379
379
  "info.plot_list_added_to": "<dark_aqua><plot></dark_aqua>",
380
380
  "info.plot_list_denied_on": "<gray><plot></gray>",
381
381
  "info.plot_list_default": "<gold><plot></gold>",
382
- "info.plot_list_player_online": "<dark_aqua><prefix></dark_aqua><hover:show_text:\"<dark_aqua>Online</dark_aqua>\"><gold><player></gold></hover>",
383
- "info.plot_list_player_offline": "<dark_aqua><prefix></dark_aqua><hover:show_text:\"<dark_gray>Offline</dark_gray>\"><gold><player></gold></hover>",
384
- "info.plot_list_player_unknown": "<hover:show_text:\"<red>The owner of this plot is unknown</red>\"><white><info.unknown></white></hover>",
385
- "info.plot_list_player_server": "<hover:show_text:\"<red>The plot is owned by the server</red>\"><white><info.server></white></hover>",
386
- "info.plot_list_player_everyone": "<hover:show_text:\"<blue>The plot is owned by everyone</blue>\"><white><info.everyone></white></hover>",
382
+ "info.plot_list_player_online": "<dark_aqua><prefix></dark_aqua><hover:show_text:'<dark_aqua>Online</dark_aqua>'><gold><player></gold></hover>",
383
+ "info.plot_list_player_offline": "<dark_aqua><prefix></dark_aqua><hover:show_text:'<dark_gray>Offline</dark_gray>'><gold><player></gold></hover>",
384
+ "info.plot_list_player_unknown": "<hover:show_text:'<red>The owner of this plot is unknown</red>'><white><info.unknown></white></hover>",
385
+ "info.plot_list_player_server": "<hover:show_text:'<red>The plot is owned by the server</red>'><white><info.server></white></hover>",
386
+ "info.plot_list_player_everyone": "<hover:show_text:'<blue>The plot is owned by everyone</blue>'><white><info.everyone></white></hover>",
387
387
  "info.area_info_format": "<header>\n<reset><gold>Name: </gold><gray><name></gray>\n<gold>Type: </gold><gray><type></gray>\n<gold>Terrain: </gold><gray><terrain></gray>\n<gold>Usage: </gold><gray><usage>%</gray>\n<gold>Claimed: </gold><gray><claimed></gray>\n<gold>Clusters: </gold><gray><clusters></gray>\n<gold>Region: </gold><gray><region></gray>\n<gold>Generator: </gold><gray><generator></gray>\n<footer>",
388
388
  "info.area_list_tooltip": "<gold>Claimed=</gold><gray><claimed></gray>\n<gold>Usage=</gold><gray><usage></gray>\n<gold>Clusters=</gold><gray><clusters></gray>\n<gold>Region=</gold><gray><region></gray>\n<gold>Generator=</gold><gray><generator></gray>",
389
- "info.area_list_item": "<click:run_command:<command_tp>><hover:show_text:\"<command_tp>\"><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click> <click:run_command:<command_info>><hover:show_text:\"<hover_info>\"><gold><area_name></gold></hover></click><gray> - </gray><gray><area_type>:<area_terrain></gray>",
389
+ "info.area_list_item": "<click:run_command:'<command_tp>'><hover:show_text:'<command_tp>'><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click> <click:run_command:'<command_info>'><hover:show_text:'<hover_info>'><gold><area_name></gold></hover></click><gray> - </gray><gray><area_type>:<area_terrain></gray>",
390
390
  "working.generating_component": "<prefix><gold>Started generating component from your settings.</gold>",
391
391
  "working.clearing_done": "<prefix><dark_aqua>Plot </dark_aqua><gold><plot></gold><dark_aqua> has been cleared! Took </dark_aqua><gold><amount>ms</gold><dark_aqua>.</dark_aqua>",
392
392
  "working.deleting_done": "<prefix><dark_aqua>Plot </dark_aqua><gold><plot></gold><dark_aqua> has been deleted! Took </dark_aqua><gold><amount>ms</gold><dark_aqua>.</dark_aqua>",
@@ -403,7 +403,7 @@
403
403
  "list.area_list_header_paged": "<gray>(Page </gray><gold><cur></gold><gray>/</gray><gold><max></gold><gray>) </gray><gold>List of <amount> areas</gold>",
404
404
  "list.plot_list_header_paged": "<gray>(Page </gray><gold><cur></gold><gray>/</gray><gold><max></gold><gray>) </gray><gold>List of <amount> plots</gold>",
405
405
  "list.plot_list_header": "<prefix><gold>List of <word> plots.</gold>",
406
- "list.page_turn": "<gold><click:run_command:<command1>>Back</gold><dark_gray> | </dark_gray><gold><click:run_command:<command2>>Next</click></gold><gray><clickable></gray>",
406
+ "list.page_turn": "<gold><click:run_command:'<command1>'>Back</gold><dark_gray> | </dark_gray><gold><click:run_command:'<command2>'>Next</click></gold><gray><clickable></gray>",
407
407
  "chat.plot_chat_spy_format": "<gray>[<gold>Plot Spy</gold>] [<gold><world>;<plot_id></gold>] <gold><sender></gold>: <gold><msg></gold></gray>",
408
408
  "chat.plot_chat_format": "<gray>[<gold>Plot Chat</gold>] [<gold><world>;<plot_id></gold>] <gold><sender></gold>: <gold><msg></gold></gray>",
409
409
  "chat.plot_chat_forced": "<prefix><gray>This world forces everyone to use plot chat.</gray>",
@@ -437,7 +437,7 @@
437
437
  "help.help_footer": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Help </gold><dark_gray><strikethrough>---------<reset>",
438
438
  "help.help_info_item": "<gold><command> <gray><category> </gray><dark_gray>- </dark_gray><gray><category_desc></gray>",
439
439
  "help.help_item": "<gold><usage> <gray>[<gold><alias></gold>]</gray>\n <dark_gray>- </dark_gray><gray><desc></gray>\n",
440
- "help.help_display_all_commands": "<prefix><gray>Display all commands.</gray>",
440
+ "help.help_display_all_commands": "<gray>Display all commands.</gray>",
441
441
  "help.direction": "<prefix><gold>Current direction: </gold><gray><dir></gray>",
442
442
  "help.no_permission": "<prefix><red>You have no permission to access commands of that sub category, hence you cannot access the help page.</red>",
443
443
  "category.command_category_claiming": "<gray>Claiming</gray>",
@@ -510,11 +510,11 @@
510
510
  "flag.flag_info_header": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
511
511
  "flag.flag_info_footer": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
512
512
  "flag.flag_list_categories": "<gold><category>: </gold>",
513
- "flag.flag_list_flag": "<click:run_command:<command>><hover:show_text:\"<gray>Click to view information about the flag.</gray>\"><gray><flag></gray></hover></click><gray><suffix></gray>",
513
+ "flag.flag_list_flag": "<click:run_command:'<command>'><hover:show_text:'<gray>Click to view information about the flag.</gray>'><gray><flag></gray></hover></click><gray><suffix></gray>",
514
514
  "flag.flag_info_name": "<gray>Name: <gold><flag></gold></gray>",
515
515
  "flag.flag_info_category": "<gray>Category: </gray><gold><value></gold>",
516
516
  "flag.flag_info_description": "<gray>Description: </gray>",
517
- "flag.flag_info_example": "<gray>Example: <click:suggest_command:<command> <flag> <value>><gold><command> <flag> <value></click></gold></gray>",
517
+ "flag.flag_info_example": "<gray>Example: <click:run_command:'<command> <flag> <value>'><gold><command> <flag> <value></gold></click></gray>",
518
518
  "flag.flag_info_default_value": "<gray>Default Value: <value></gray>",
519
519
  "flags.flag_category_string": "<gray>String Flags</gray>",
520
520
  "flags.flag_category_integers": "<gray>Integer Flags</gray>",
build.gradle.kts CHANGED
@@ -18,7 +18,7 @@ plugins {
18
18
  }
19
19
 
20
20
  group = "com.plotsquared"
21
- version = "6.10.10-SNAPSHOT"
21
+ version = "7.0.0-SNAPSHOT"
22
22
 
23
23
  if (!File("$rootDir/.git").exists()) {
24
24
  logger.lifecycle("""
@@ -74,7 +74,7 @@ subprojects {
74
74
  }
75
75
 
76
76
  dependencies {
77
- implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.22"))
77
+ implementation(platform("com.intellectualsites.bom:bom-newest:1.22"))
78
78
  }
79
79
 
80
80
  dependencies {
gradle/libs.versions.toml CHANGED
@@ -16,7 +16,6 @@ aopalliance = "1.0"
16
16
  cloud-services = "1.8.0"
17
17
  arkitektonika = "2.1.1"
18
18
  squirrelid = "0.3.1"
19
- http4j = "1.3"
20
19
 
21
20
  # Gradle plugins
22
21
  shadow = "7.1.2"
@@ -44,7 +43,6 @@ cloudServices = { group = "cloud.commandframework", name = "cloud-services", ver
44
43
  mvdwapi = { group = "com.intellectualsites.mvdwplaceholderapi", name = "MVdWPlaceholderAPI", version.ref = "mvdwapi" }
45
44
  squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" }
46
45
  arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitektonika-Client", version.ref = "arkitektonika" }
47
- http4j = { group = "com.intellectualsites.http", name = "HTTP4J", version.ref = "http4j" }
48
46
 
49
47
  [plugins]
50
48
  shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }